Merge pull request #47 from RossBugginsNHS/copilot/update-docs-github… #1
This file contains hidden or 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: Publish Dev Container | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - .devcontainer/Dockerfile | |
| - mise.toml | |
| - mise.lock | |
| tags: | |
| - "devcontainer/v*" | |
| pull_request: | |
| paths: | |
| - .devcontainer/Dockerfile | |
| - mise.toml | |
| - mise.lock | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| env: | |
| # Image is always lowercased; GitHub Container Registry requires lowercase names. | |
| IMAGE_NAME: ghcr.io/rossbugginsnhs/github-workflow-dispatcher/devcontainer | |
| jobs: | |
| build: | |
| name: Build and Publish Dev Container | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Set up QEMU (for multi-platform builds) | |
| uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0 | |
| - name: Log in to GitHub Container Registry | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract image metadata | |
| id: meta | |
| uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0 | |
| with: | |
| images: ${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }} | |
| type=match,pattern=devcontainer/v(\d+\.\d+\.\d+),group=1 | |
| type=match,pattern=devcontainer/v(\d+\.\d+),group=1 | |
| type=sha,prefix=sha-,format=short | |
| - name: Build and push | |
| uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 | |
| with: | |
| context: .devcontainer | |
| file: .devcontainer/Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| push: ${{ github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/devcontainer/')) }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| provenance: false |