feat: embed theme-core-based UI releases #604
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Pano Release | |
| on: | |
| push: | |
| branches: [ "alpha", "beta", "main" ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| get_next_version: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 'latest' | |
| - name: Dry run to get next release version | |
| id: get_next_version | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }} | |
| run: | | |
| export NEXT_TAG_VERSION=$(npx semantic-release --dry-run | grep 'next release version is ' | awk -F"next release version is " '{print $2}') | |
| echo "new_tag_version=${NEXT_TAG_VERSION}" >> $GITHUB_OUTPUT | |
| - name: Echo new_tag_version | |
| run: | | |
| echo "Extracted Tag Version: ${{ steps.get_next_version.outputs.new_tag_version }}" | |
| outputs: | |
| new_tag_version: ${{ steps.get_next_version.outputs.new_tag_version }} | |
| build_and_release: | |
| runs-on: ubuntu-latest | |
| needs: get_next_version | |
| if: ${{ needs.get_next_version.outputs.new_tag_version != '' }} | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Extract branch name | |
| id: extract_branch | |
| shell: bash | |
| run: | | |
| echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | |
| - name: Get Time | |
| id: time | |
| uses: nanzm/get-time-action@v1.1 | |
| with: | |
| timeZone: 8 | |
| format: 'YYYYMMDDHHmmss' | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Download UI Releases | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }} | |
| run: | | |
| ./gradlew downloadUIReleases | |
| - name: Build | |
| run: | | |
| ./gradlew ${{ steps.extract_branch.outputs.branch == 'main' && 'build' || 'buildDev' }} \ | |
| -PbuildType=${{ steps.extract_branch.outputs.branch == 'main' && 'release' || steps.extract_branch.outputs.branch }} \ | |
| -Pversion=${{ needs.get_next_version.outputs.new_tag_version }} \ | |
| -PtimeStamp=${{ steps.time.outputs.time }} | |
| - uses: oven-sh/setup-bun@v2 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 'latest' | |
| # Generate UI changelog from ZIP names and UI repos | |
| - name: Generate UI changelog | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }} | |
| run: | | |
| bun ./scripts/aggregate-ui-changelog.js | |
| if [ -f UI_CHANGELOG.md ]; then | |
| echo "---- UI_CHANGELOG.md (preview) ----" | |
| sed -n '1,120p' UI_CHANGELOG.md | |
| echo "-----------------------------------" | |
| fi | |
| - name: Release (semantic-release) | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }} | |
| run: | | |
| npx semantic-release@24.2.6 | |
| # Append UI changelog to latest release with a Markdown separator | |
| - name: Append UI changelog to latest release | |
| if: success() | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const path = 'UI_CHANGELOG.md'; | |
| if (!fs.existsSync(path)) { | |
| core.info('UI_CHANGELOG.md not found, skipping.'); | |
| return; | |
| } | |
| const extraRaw = fs.readFileSync(path, 'utf8'); | |
| const extra = extraRaw.trimEnd(); | |
| if (!extra) { | |
| core.info('UI_CHANGELOG.md empty, skipping.'); | |
| return; | |
| } | |
| const { owner, repo } = context.repo; | |
| const { data: releases } = await github.rest.repos.listReleases({ owner, repo, per_page: 1 }); | |
| if (!releases.length) { | |
| core.warning('No releases found to update.'); | |
| return; | |
| } | |
| const rel = releases[0]; | |
| // Use a Markdown separator to FORCE paragraph break & block context reset. | |
| // Also add a non-breaking space paragraph to fully exit list contexts. | |
| const separator = '\n\n \n\n---\n\n'; | |
| const base = (rel.body || '').replace(/\s+$/,''); // trim trailing ws/newlines | |
| const newBody = base + separator + extra; | |
| await github.rest.repos.updateRelease({ | |
| owner, repo, release_id: rel.id, body: newBody | |
| }); | |
| core.info('Appended UI changelog with Markdown separator and spacing.'); |