Skip to content

Release 11 juni: API-key 401 fix, taaklog-fixes, orphan/backup-sweeps… #194

Release 11 juni: API-key 401 fix, taaklog-fixes, orphan/backup-sweeps…

Release 11 juni: API-key 401 fix, taaklog-fixes, orphan/backup-sweeps… #194

Workflow file for this run

name: Docker - Operations Manager
on:
push:
branches: [main]
paths:
- 'operations-manager/Dockerfile'
- 'operations-manager/python/**'
pull_request:
paths:
- 'operations-manager/Dockerfile'
- 'operations-manager/python/**'
permissions:
contents: write # needed to push the CalVer git tag
packages: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: ghcr.io/rijksictgilde/zad/operations-manager
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # needed for CalVer tag calculation
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Calculate CalVer tag
id: calver
if: github.ref == 'refs/heads/main'
run: |
PREFIX="$(date -u +%Y.%-m)"
PATCH=$(git tag -l "${PREFIX}.*" | sed "s/${PREFIX}\.//" | sort -n | tail -1)
NEXT_PATCH=$(( ${PATCH:-0} + 1 ))
TAG="${PREFIX}.${NEXT_PATCH}"
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
echo "CalVer tag: ${TAG}"
- name: Generate image tags
id: tags
run: |
SHA_SHORT="${GITHUB_SHA::7}"
TAGS="${{ env.IMAGE_NAME }}:sha-${GITHUB_SHA}"
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
TAGS="${TAGS},${{ env.IMAGE_NAME }}:${{ steps.calver.outputs.tag }}"
TAGS="${TAGS},${{ env.IMAGE_NAME }}:latest"
else
PR_NUMBER="${{ github.event.pull_request.number }}"
TAGS="${TAGS},${{ env.IMAGE_NAME }}:pr-${PR_NUMBER}-sha-${SHA_SHORT}"
fi
echo "tags=${TAGS}" >> "$GITHUB_OUTPUT"
echo "Generated tags: ${TAGS}"
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: operations-manager/Dockerfile
target: application
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.tags.outputs.tags }}
provenance: false
sbom: false
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Create CalVer git tag
if: github.ref == 'refs/heads/main'
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git tag "${{ steps.calver.outputs.tag }}"
git push origin "${{ steps.calver.outputs.tag }}"