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 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 }} 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 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: range-release-notes - 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_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/*