Build on Release (DEPRECATED) #2
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: Build on Release | |
| on: | |
| release: | |
| types: [ published ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install dependencies | |
| working-directory: / | |
| run: npm install | |
| - name: Install sub-project dependencies | |
| working-directory: projects/switch520-auto-secret | |
| run: npm install | |
| - name: Build project | |
| working-directory: projects/switch520-auto-secret | |
| run: npm run build | |
| # 可选:读取 Release Notes(用于后续 webhook / 发布) | |
| - name: Extract release notes | |
| id: notes | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const body = context.payload.release.body || ''; | |
| core.setOutput('notes', body); | |
| # 示例:调用 GreasyFork webhook(你已配置) | |
| - name: Notify GreasyFork | |
| run: | | |
| curl -X POST "${{ secrets.GREASYFORK_WEBHOOK_URL }}" \ | |
| -H "Content-Type: application/json" \ | |
| -d "$(jq -n \ | |
| --arg tag "${{ github.event.release.tag_name }}" \ | |
| --arg notes "${{ steps.notes.outputs.notes }}" \ | |
| '{tag: $tag, notes: $notes}')" | |
| - name: Upload build artifacts | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| projects/switch520-auto-secret/dist/** |