chore: release v1.16.0 #132
Workflow file for this run
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Tag to release (e.g. v0.1.0)' | |
| required: true | |
| permissions: | |
| contents: write | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true' | |
| jobs: | |
| release: | |
| name: Build & Publish Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build all packages | |
| run: npm run build | |
| - name: Determine tag name | |
| id: tag | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| echo "name=${{ github.event.inputs.tag }}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "name=${{ github.ref_name }}" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Package server artifact | |
| run: | | |
| TAG="${{ steps.tag.outputs.name }}" | |
| mkdir -p release_artifacts/server | |
| cp -r packages/server/dist release_artifacts/server/dist | |
| cp -r packages/server/drizzle release_artifacts/server/drizzle | |
| cp packages/server/package.json release_artifacts/server/package.json | |
| cd release_artifacts | |
| zip -r "../zenith-admin-server-${TAG}.zip" server/ | |
| cd .. | |
| - name: Package web artifact | |
| run: | | |
| TAG="${{ steps.tag.outputs.name }}" | |
| mkdir -p release_artifacts/web | |
| cp -r packages/web/dist release_artifacts/web/dist | |
| cd release_artifacts | |
| zip -r "../zenith-admin-web-${TAG}.zip" web/ | |
| cd .. | |
| - name: Extract release notes from CHANGELOG | |
| run: | | |
| TAG="${{ steps.tag.outputs.name }}" | |
| node -e " | |
| const fs = require('fs'); | |
| const tag = process.env.TAG; | |
| const content = fs.readFileSync('docs/changelog/index.md', 'utf-8'); | |
| const start = content.indexOf('## ' + tag); | |
| if (start < 0) { | |
| fs.writeFileSync('RELEASE_NOTES.md', '请查阅 [CHANGELOG](https://iwangbowen.github.io/zenith-admin/changelog/) 获取完整变更信息。'); | |
| process.exit(0); | |
| } | |
| const end = content.indexOf('\n## ', start + 1); | |
| const notes = content.slice(start, end > 0 ? end : undefined).trim(); | |
| fs.writeFileSync('RELEASE_NOTES.md', notes); | |
| " | |
| env: | |
| TAG: ${{ steps.tag.outputs.name }} | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.tag.outputs.name }} | |
| name: ${{ steps.tag.outputs.name }} | |
| body_path: RELEASE_NOTES.md | |
| draft: false | |
| prerelease: ${{ contains(steps.tag.outputs.name, '-beta') || contains(steps.tag.outputs.name, '-rc') || contains(steps.tag.outputs.name, '-alpha') }} | |
| files: | | |
| zenith-admin-server-${{ steps.tag.outputs.name }}.zip | |
| zenith-admin-web-${{ steps.tag.outputs.name }}.zip |