Build and push image to Github Container Registry #29
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: Build and push image to Github Container Registry | |
| on: | |
| workflow_run: | |
| workflows: ["Update docs data"] # This must exactly match the name: in update-docs-data.yml | |
| types: | |
| - completed | |
| jobs: | |
| docker-build-push: | |
| name: Push Automat API docs to GHCR | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'release' }} | |
| steps: | |
| - name: Check out the repo | |
| uses: actions/checkout@v4 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract release tag | |
| id: vars | |
| run: echo "TAG=${GITHUB_REF_NAME}" >> $GITHUB_ENV | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: true | |
| tags: | | |
| ghcr.io/robokopu24/api-docs:${{ env.TAG }} | |
| ghcr.io/robokopu24/api-docs:latest |