ci: split release from build (#749)
This commit is contained in:
@@ -1,28 +1,9 @@
|
||||
name: Release - Publish Stable Images
|
||||
name: On Release Published
|
||||
|
||||
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
|
||||
release:
|
||||
types:
|
||||
- released
|
||||
|
||||
jobs:
|
||||
build-and-release:
|
||||
@@ -38,15 +19,7 @@ jobs:
|
||||
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
|
||||
env:
|
||||
RELEASE_TAG: ${{ inputs.release_tag }}
|
||||
run: |
|
||||
echo "release_tag=${RELEASE_TAG}" >> "$GITHUB_ENV"
|
||||
echo "commit_sha=$(git rev-parse HEAD)" >> "$GITHUB_ENV"
|
||||
echo "Stable release tag: ${RELEASE_TAG}"
|
||||
ref: ${{ github.sha }}
|
||||
|
||||
- name: Set Up QEMU for Multi-Arch Builds
|
||||
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
|
||||
@@ -77,13 +50,13 @@ jobs:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: |
|
||||
grimmory/grimmory:${{ env.release_tag }}
|
||||
grimmory/grimmory:${{ github.event.release.tag_name }}
|
||||
grimmory/grimmory:latest
|
||||
ghcr.io/grimmory-tools/grimmory:${{ env.release_tag }}
|
||||
ghcr.io/grimmory-tools/grimmory:${{ github.event.release.tag_name }}
|
||||
ghcr.io/grimmory-tools/grimmory:latest
|
||||
build-args: |
|
||||
APP_VERSION=${{ env.release_tag }}
|
||||
APP_REVISION=${{ env.commit_sha }}
|
||||
APP_VERSION=${{ github.event.release.tag_name }}
|
||||
APP_REVISION=${{ github.sha }}
|
||||
cache-from: |
|
||||
type=gha,scope=image-shared
|
||||
type=registry,ref=ghcr.io/grimmory-tools/grimmory:buildcache
|
||||
@@ -91,9 +64,60 @@ jobs:
|
||||
type=gha,scope=image-shared,mode=max
|
||||
type=registry,ref=ghcr.io/grimmory-tools/grimmory:buildcache,mode=max
|
||||
|
||||
- name: Publish Draft GitHub Release
|
||||
prepare-release-notification:
|
||||
name: Prepare Stable Release Notification
|
||||
needs:
|
||||
- build-and-release
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
outputs:
|
||||
base_tag: ${{ steps.metadata.outputs.base_tag }}
|
||||
compare_url: ${{ steps.metadata.outputs.compare_url }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.release.tag_name }}
|
||||
|
||||
- name: Extract Stable Release Metadata
|
||||
id: metadata
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.RELEASE_BOT_TOKEN != '' && secrets.RELEASE_BOT_TOKEN || github.token }}
|
||||
RELEASE_TAG: ${{ env.release_tag }}
|
||||
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
||||
RELEASE_URL: ${{ github.event.release.html_url }}
|
||||
run: |
|
||||
gh release edit "${RELEASE_TAG}" --draft=false
|
||||
set -eu
|
||||
|
||||
git fetch origin main --tags --force
|
||||
BASE_TAG="$(git tag --sort=-version:refname 'v*' | grep -Fxv "$RELEASE_TAG" | head -n 1 || true)"
|
||||
|
||||
COMPARE_URL="${RELEASE_URL}"
|
||||
if [ -n "$BASE_TAG" ]; then
|
||||
COMPARE_URL="https://github.com/${GITHUB_REPOSITORY}/compare/${BASE_TAG}...${RELEASE_TAG}"
|
||||
fi
|
||||
{
|
||||
echo "base_tag=${BASE_TAG}"
|
||||
echo "compare_url=${COMPARE_URL}"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
|
||||
notify-discord:
|
||||
name: Notify Discord Release
|
||||
needs:
|
||||
- prepare-release-notification
|
||||
permissions: {}
|
||||
uses: ./.github/workflows/notify-discord-release-notes.yml
|
||||
secrets:
|
||||
discord_webhook: ${{ secrets.DISCORD_STABLE_WEBHOOK }}
|
||||
with:
|
||||
channel: stable
|
||||
current_version: ${{ github.event.release.tag_name }}
|
||||
predicted_version: ${{ github.event.release.tag_name }}
|
||||
details_url: ${{ github.event.release.html_url }}
|
||||
candidate_sha: ${{ github.sha }}
|
||||
base_tag: ${{ needs.prepare-release-notification.outputs.base_tag }}
|
||||
compare_url: ${{ needs.prepare-release-notification.outputs.compare_url }}
|
||||
mention_text: ${{ vars.DISCORD_STABLE_MENTIONS }}
|
||||
|
||||
Reference in New Issue
Block a user