| name: Publish Docker image |
| |
| permissions: read-all |
| |
| on: |
| # For initial testing and we can remove it later. |
| workflow_dispatch: |
| inputs: |
| tag: |
| description: 'Tag for the container image' |
| required: true |
| type: string |
| |
| jobs: |
| docker-publish: |
| name: Publish Docker image |
| runs-on: ubuntu-24.04 |
| permissions: |
| contents: read |
| packages: write |
| env: |
| REGISTRY: ghcr.io |
| IMAGE_NAME: ${{ github.repository }} |
| steps: |
| - name: Check out repository |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| # Based on https://docs.github.com/en/actions/publishing-packages/publishing-docker-images. |
| - name: Log in to the Container registry |
| uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0 |
| with: |
| registry: ${{ env.REGISTRY }} |
| username: ${{ github.actor }} |
| password: ${{ secrets.GITHUB_TOKEN }} |
| - name: Extract metadata (tags, labels) for Docker |
| id: meta |
| uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0 |
| with: |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| tags: | |
| latest |
| type=raw,value=${{ inputs.tag }} |
| - name: Build and push the Docker image |
| uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 |
| with: |
| context: ./tools/docker |
| push: true |
| tags: ${{ steps.meta.outputs.tags }} |
| labels: ${{ steps.meta.outputs.labels }} |