Build & Test Devcontainer Docker Image #40
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & Test Devcontainer Docker Image | |
on: | |
workflow_dispatch: | |
workflow_run: | |
workflows: "R-CMD-check" | |
branches: main | |
types: completed | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event_name }} | |
cancel-in-progress: true | |
jobs: | |
build-devcontainer: | |
runs-on: ubuntu-latest | |
if: | | |
github.event_name == 'workflow_dispatch' || | |
github.event_name == 'release' || | |
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') | |
strategy: | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Determine Tag | |
id: tag | |
run: | | |
if [ "${{ github.ref_name }}" == "main" ]; then | |
echo "tag=devel" >> "$GITHUB_OUTPUT" | |
echo "EGGLA_VERSION=main" >> "$GITHUB_ENV" | |
else | |
echo "tag=latest,${{ github.ref_name }}" >> "$GITHUB_OUTPUT" | |
echo "EGGLA_VERSION=${{ github.ref_name }}" >> "$GITHUB_ENV" | |
fi | |
- name: Build and run Dev Container on release | |
uses: devcontainers/[email protected] | |
if: | |
with: | |
subFolder: .github | |
imageName: ghcr.io/${{ github.repository }} | |
imageTag: ${{ steps.tag.outputs.tag }} | |
push: always | |
runCmd: Rscript /eggla-example.R | |
clean: | |
needs: 'build-devcontainer' | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- name: Delete obsolete/untagged versions | |
uses: actions/delete-package-versions@v5 | |
with: | |
package-name: ${{ github.event.repository.name }} | |
package-type: "container" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
delete-only-untagged-versions: "true" |