Skip to content

v1.8.0

v1.8.0 #10

name: Docker Publish Multi-Arch on Release
on:
release:
types: [published]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
sync-version:
name: Sync application.properties with release tag
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout main
uses: actions/checkout@v5
with:
ref: main
token: ${{ secrets.MAIN_PUSH_TOKEN }}
- name: Configure git as the maintainer
run: |
git config user.name "PianoNic"
git config user.email "79938743+PianoNic@users.noreply.github.com"
- name: Compare versions and open + merge sync PR if different
env:
GH_TOKEN: ${{ secrets.MAIN_PUSH_TOKEN }}
run: |
TAG_VERSION="${{ github.event.release.tag_name }}"
TAG_VERSION="${TAG_VERSION#v}"
FILE_VERSION=$(grep -oP '(?<=<version>)[^<]+' application.properties)
echo "Release tag version: $TAG_VERSION"
echo "File version: $FILE_VERSION"
if [ "$TAG_VERSION" = "$FILE_VERSION" ]; then
echo "Already in sync, nothing to do."
exit 0
fi
sed -i "s|<version>$FILE_VERSION</version>|<version>$TAG_VERSION</version>|" application.properties
BRANCH="release-sync/$TAG_VERSION"
git checkout -b "$BRANCH"
git add application.properties
git commit -m "Bumped application.properties to $TAG_VERSION for release"
git push origin "$BRANCH"
PR_URL=$(gh pr create \
--base main \
--head "$BRANCH" \
--title "Bumped application.properties to $TAG_VERSION for release" \
--body "Bumped application.properties to $TAG_VERSION for release" \
--label CI/CD)
gh pr merge "$PR_URL" --admin --squash --delete-branch
build-and-push-multiarch:
name: Build and Push Multi-Arch Docker Images
needs: sync-version
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout main
uses: actions/checkout@v5
with:
ref: main
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
continue-on-error: true
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ secrets.DOCKERHUB_USERNAME }}/schulykeycloak
ghcr.io/schulydev/schulykeycloak
tags: |
type=semver,pattern={{version}},value=${{ github.event.release.tag_name }}
type=semver,pattern={{major}}.{{minor}},value=${{ github.event.release.tag_name }}
type=semver,pattern={{major}},value=${{ github.event.release.tag_name }}
type=raw,value=latest,enable=${{ !github.event.release.prerelease }}
- name: Build and push Multi-Arch Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: |
type=gha
type=registry,ref=ghcr.io/schulydev/schulykeycloak:buildcache
cache-to: |
type=gha,mode=max
type=registry,ref=ghcr.io/schulydev/schulykeycloak:buildcache,mode=max
build-args: |
BUILDKIT_INLINE_CACHE=1
provenance: false
sbom: false