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@fbda4c85fc2e1e08721cd8763afea8f48d60f024 # v3.0.0 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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 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@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/grimmory/browser" - 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@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@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 steps: - name: Checkout Repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 persist-credentials: false - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: frontend skip-decompress: true path: artifacts/ - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: backend path: artifacts/ - 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 }} 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/*