ci: publish jar / openapi json to release draft (#2243)

This commit is contained in:
James Ward
2026-08-05 02:45:31 -04:00
committed by GitHub
parent 99f21b540f
commit 09055fb613
2 changed files with 241 additions and 16 deletions
+196 -16
View File
@@ -29,11 +29,168 @@ jobs:
checkout_ref: ${{ github.sha }}
save_gradle_cache: true
semantic-release:
name: Compute Release, Update Changelog, and Draft GitHub Release
needs: [migration-check, test-suite]
semantic-version:
name: Compute Release and Changelog
needs:
- migration-check
- test-suite
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
version: ${{ steps.notes.outputs.predicted_version }}
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
base_tag="$(git describe --tags --abbrev=0 --match 'v*' origin/main)"
from_ref="$base_tag"
echo "base_tag=${base_tag}" >> "$GITHUB_OUTPUT"
echo "commit_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
echo "from_ref=${from_ref}" >> "$GITHUB_OUTPUT"
- name: Build Changelog
id: notes
uses: ./.github/actions/compute-release-notes
with:
base_tag: ${{ steps.resolve.outputs.base_tag }}
from_ref: ${{ steps.resolve.outputs.from_ref }}
repository_url: ${{ format('{0}/{1}', github.server_url, github.repository) }}
to_ref: ${{ steps.resolve.outputs.commit_sha }}
build-frontend:
name: Build frontend
needs:
- semantic-version
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout Repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
persist-credentials: false
- name: Set Up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
with:
node-version-file: .nvmrc
- name: Set Up pnpm
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
with:
version: 11
cache: true
run_install: |
- cwd: frontend/
package_json_file: frontend/package.json
- name: Build frontend
working-directory: frontend/
env:
APP_VERSION: ${{ needs.semantic-version.outputs.version }}
run:
pnpm build:prod
- name: Upload Frontend Artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: frontend
path: frontend/dist/grimmory/browser/
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@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
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"
- name: Upload Backend Jar Artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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
@@ -44,24 +201,47 @@ jobs:
fetch-depth: 0
persist-credentials: false
- name: Install just
uses: taiki-e/install-action@065d6a08a14e61e89fb0a4c10eecdbdef39c7d8e # v2.85.4
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
tool: just
name: range-release-notes
- name: Set Up pnpm
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
- name: Set Up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
node-version-file: .nvmrc
name: frontend
skip-decompress: true
path: artifacts/
- name: Install Release Tooling Dependencies
run: just release install
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: backend
path: artifacts/
- name: Run semantic-release
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
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 }}
run: just release run
RELEASE_VERSION: ${{ needs.semantic-version.outputs.version }}
TARGET_REF: ${{ github.sha }}
run: |
gh release create \
"v${RELEASE_VERSION}" \
--title "Release v${RELEASE_VERSION}" \
--draft \
--latest \
--target "${TARGET_REF}" \
--notes-file ./range-release-notes.md \
release-assets/*