Skip to content

Publish Resolver Image #43

Publish Resolver Image

Publish Resolver Image #43

Workflow file for this run

name: Publish Resolver Image
on:
push:
tags:
- "v*"
concurrency:
group: release-${{ github.ref_name }}
cancel-in-progress: true
jobs:
publish:
name: Build and publish GHCR image
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
env:
VERSION: ${{ github.ref_name }}
steps:
- name: Checkout release tag
uses: actions/checkout@v4
with:
ref: ${{ env.VERSION }}
- name: Normalize owner for GHCR
id: owner
run: echo "owner_lc=${GITHUB_REPOSITORY_OWNER,,}" >> "$GITHUB_OUTPUT"
- 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: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push resolver
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/${{ steps.owner.outputs.owner_lc }}/resolver:${{ env.VERSION }}
- name: Extract changelog entry for this version
run: |
set -euo pipefail
if [ ! -f CHANGELOG.md ]; then
echo "CHANGELOG.md not found at repository root." >&2
exit 1
fi
awk -v version="$VERSION" '
BEGIN { in_section=0; found=0 }
/^## \[/ {
if ($0 ~ "^## \\[" version "\\]") {
in_section=1
found=1
print
next
}
if (in_section==1) exit
}
in_section==1 { print }
END {
if (!found) {
print "No changelog entry found for " version > "/dev/stderr"
exit 1
}
}
' CHANGELOG.md > release-notes.md
if [ ! -s release-notes.md ]; then
echo "release-notes.md is empty for ${VERSION}" >&2
exit 1
fi
- name: Create or update release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.VERSION }}
name: ${{ env.VERSION }}
body_path: release-notes.md
generate_release_notes: false