Files
grimmory/.github/workflows/release-main.yml
T
dependabot[bot]andAlex a83baedaf5 chore(deps): bump pnpm/setup from 3.0.0 to 3.1.1 (#2915)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alex <25013571+alexhb1@users.noreply.github.com>
2026-10-16 11:04:27 +01:00

243 lines
6.5 KiB
YAML

name: Release - Semantic Stable
on:
push:
branches:
- main
concurrency:
group: release-main
cancel-in-progress: false
jobs:
migration-check:
name: Flyway Migration Check
uses: ./.github/workflows/migrations-check.yml
permissions:
contents: read
with:
base_ref: ${{ github.event.before }}
head_ref: ${{ github.sha }}
checkout_ref: ${{ github.sha }}
test-suite:
name: Test Suite
needs: [migration-check]
uses: ./.github/workflows/test-suite.yml
permissions:
contents: read
checks: write
with:
checkout_ref: ${{ github.sha }}
resolve-refs:
name: Resolve release ref
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
commit-sha: ${{ steps.resolve.outputs.commit_sha }}
from-ref: ${{ steps.resolve.outputs.from_ref }}
steps:
- name: Checkout Repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Record Resolved Commit
id: resolve
env:
GH_TOKEN: ${{ github.token }}
run: |
set -eu
git fetch origin main --tags --force
from_ref="$(git describe --tags --abbrev=0 --match 'v*' origin/main)"
echo "commit_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
echo "from_ref=${from_ref}" >> "$GITHUB_OUTPUT"
semantic-version:
name: Generate Notes
needs:
- resolve-refs
- migration-check
uses: ./.github/workflows/compute-release-notes.yml
permissions:
contents: read
with:
bump: true
from-ref: ${{ needs.resolve-refs.outputs.from-ref }}
to-ref: ${{ needs.resolve-refs.outputs.commit-sha }}
secrets: inherit
build-frontend:
name: Build frontend
needs:
- semantic-version
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout Repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Set Up pnpm and Node.js
uses: pnpm/setup@a0881977cd8ea73b1ed212236c99ca10dcc80cf4 # v3.1.1
with:
node-version-file: .nvmrc
cache: true
- name: Build frontend
working-directory: frontend/
env:
APP_VERSION: ${{ needs.semantic-version.outputs.version }}
run:
pnpm build:prod
- name: Embed LICENSE information
run:
cp LICENSE NOTICE frontend/dist/
- name: Upload Frontend Artifact
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: frontend
path: frontend/dist/
retention-days: 30
build-backend:
name: Build backend
needs:
- semantic-version
- build-frontend
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout Repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: frontend
path: /tmp/frontend-dist/
- name: Build Backend Jar
uses: ./.github/actions/gradle-task/
with:
app-version: ${{ needs.semantic-version.outputs.version }}
task: bootJar
task-extra-params: "-PfrontendDistDir=/tmp/frontend-dist/grimmory/browser"
- name: Upload Backend Jar Artifact
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: backend
path: backend/build/libs/
retention-days: 30
build-openapi:
name: Build OpenAPI document
needs:
- semantic-version
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout Repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Generate OpenAPI JSON
uses: ./.github/actions/gradle-task/
with:
app-version: ${{ needs.semantic-version.outputs.version }}
task: buildOpenApiArtifacts
- name: Upload Nightly OpenAPI Artifact
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: openapi
path: backend/build/openapi/
retention-days: 30
draft-release:
name: Create Draft Release
runs-on: ubuntu-latest
needs:
- semantic-version
- build-frontend
- build-backend
- build-openapi
permissions:
contents: write
steps:
- name: Checkout Repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: frontend
skip-decompress: true
path: artifacts/
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: backend
path: artifacts/
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: openapi
path: artifacts/
- name: Create assets directory
run: |
mkdir -p release-assets/
cp artifacts/backend*.jar release-assets/grimmory.jar
cp artifacts/grimmory-openapi.json release-assets/openapi.json
cp artifacts/frontend.zip release-assets/frontend.zip
- name: Create Draft Release
id: draft-release
env:
GH_TOKEN: ${{ secrets.RELEASE_BOT_TOKEN != '' && secrets.RELEASE_BOT_TOKEN || github.token }}
GITHUB_TOKEN: ${{ secrets.RELEASE_BOT_TOKEN != '' && secrets.RELEASE_BOT_TOKEN || github.token }}
RELEASE_NOTES: ${{ needs.semantic-version.outputs.release-notes }}
RELEASE_VERSION: ${{ needs.semantic-version.outputs.version }}
TARGET_REF: ${{ github.sha }}
run: |
gh release create \
"${RELEASE_VERSION}" \
--title "Release ${RELEASE_VERSION}" \
--draft \
--latest \
--target "${TARGET_REF}" \
--notes "${RELEASE_NOTES}" \
release-assets/*