- GitHub Actions caching: - replace implicit setup-java cache writes with explicit Gradle cache restore/save steps - only persist the shared Gradle cache from long-lived develop and release workflows - remove the unnecessary QEMU setup from the single-arch smoke build - disable QEMU image caching in multi-arch publish workflows to stop repeated binfmt cache entries - CodeQL workflow: - replace the generated advanced template with a pinned repo-owned CodeQL workflow - add per-ref concurrency to cancel superseded CodeQL runs before they create more caches - restrict dependency caching to Java, using restore-only on pull requests and full caching on long-lived runs - disable trap caching and turn off PR overlay database caching to avoid repetitive low-value CodeQL caches - Validation: - validated the edited workflow YAML with yq - did not execute the workflows locally
97 lines
3.3 KiB
YAML
97 lines
3.3 KiB
YAML
name: Release - Publish Stable Images
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
release_tag:
|
|
description: 'The release tag to publish (for example v2.2.3)'
|
|
required: true
|
|
type: string
|
|
commit_sha:
|
|
description: 'The release commit SHA to package; if omitted, the tag ref is checked out'
|
|
required: false
|
|
default: ''
|
|
type: string
|
|
workflow_dispatch:
|
|
inputs:
|
|
release_tag:
|
|
description: 'The existing release tag to publish (for example v2.2.3)'
|
|
required: true
|
|
type: string
|
|
commit_sha:
|
|
description: 'Optional release commit SHA override'
|
|
required: false
|
|
default: ''
|
|
type: string
|
|
|
|
jobs:
|
|
build-and-release:
|
|
name: Build, Publish, and Finalize Stable Release
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
contents: write
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
with:
|
|
fetch-depth: 1
|
|
ref: ${{ inputs.commit_sha != '' && inputs.commit_sha || format('refs/tags/{0}', inputs.release_tag) }}
|
|
|
|
- name: Record Release Tag and Commit
|
|
run: |
|
|
echo "release_tag=${{ inputs.release_tag }}" >> "$GITHUB_ENV"
|
|
echo "commit_sha=$(git rev-parse HEAD)" >> "$GITHUB_ENV"
|
|
echo "Stable release tag: ${{ inputs.release_tag }}"
|
|
|
|
- name: Set Up QEMU for Multi-Arch Builds
|
|
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3
|
|
with:
|
|
cache-image: false
|
|
|
|
- name: Set Up Docker Buildx
|
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
|
|
|
- name: Authenticate to Docker Hub
|
|
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Authenticate to GitHub Container Registry
|
|
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ github.token }}
|
|
|
|
- name: Build and push Stable image
|
|
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
|
|
with:
|
|
context: .
|
|
file: Dockerfile
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: |
|
|
grimmory/grimmory:${{ env.release_tag }}
|
|
grimmory/grimmory:latest
|
|
ghcr.io/grimmory-tools/grimmory:${{ env.release_tag }}
|
|
ghcr.io/grimmory-tools/grimmory:latest
|
|
build-args: |
|
|
APP_VERSION=${{ env.release_tag }}
|
|
APP_REVISION=${{ env.commit_sha }}
|
|
cache-from: |
|
|
type=gha,scope=image-shared
|
|
type=registry,ref=ghcr.io/grimmory-tools/grimmory:buildcache
|
|
cache-to: |
|
|
type=gha,scope=image-shared,mode=max
|
|
type=registry,ref=ghcr.io/grimmory-tools/grimmory:buildcache,mode=max
|
|
|
|
- name: Publish Draft GitHub Release
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.RELEASE_BOT_TOKEN != '' && secrets.RELEASE_BOT_TOKEN || github.token }}
|
|
run: |
|
|
gh release edit "${{ env.release_tag }}" --draft=false
|