Skip to content

Build and push image to Github Container Registry #29

Build and push image to Github Container Registry

Build and push image to Github Container Registry #29

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