v0.12.7 #43
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: | |
| release: | |
| types: [published] | |
| permissions: | |
| contents: read | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| status: ${{ steps.publish.outcome }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Get version | |
| id: version | |
| run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'pnpm' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build | |
| run: pnpm build | |
| - name: Publish to npm | |
| id: publish | |
| run: npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| notify: | |
| runs-on: ubuntu-latest | |
| needs: publish | |
| if: always() | |
| steps: | |
| - name: Notify Feishu on success | |
| if: needs.publish.outputs.status == 'success' | |
| run: | | |
| curl -X POST "${{ secrets.FEISHU_WEBHOOK }}" \ | |
| -H "Content-Type: application/json" \ | |
| -d '{ | |
| "msg_type": "interactive", | |
| "card": { | |
| "header": { | |
| "title": { "tag": "plain_text", "content": "✅ larkcc 发布成功" }, | |
| "template": "green" | |
| }, | |
| "elements": [ | |
| { "tag": "div", "text": { "tag": "lark_md", "content": "**版本:** ${{ needs.publish.outputs.version }}" } }, | |
| { "tag": "div", "text": { "tag": "lark_md", "content": "**npm:** https://www.npmjs.com/package/larkcc" } }, | |
| { "tag": "div", "text": { "tag": "lark_md", "content": "**GitHub:** https://github.com/suj1e/larkcc/releases/tag/v${{ needs.publish.outputs.version }}" } } | |
| ] | |
| } | |
| }' | |
| - name: Notify Feishu on failure | |
| if: needs.publish.outputs.status == 'failure' | |
| run: | | |
| curl -X POST "${{ secrets.FEISHU_WEBHOOK }}" \ | |
| -H "Content-Type: application/json" \ | |
| -d '{ | |
| "msg_type": "interactive", | |
| "card": { | |
| "header": { | |
| "title": { "tag": "plain_text", "content": "❌ larkcc 发布失败" }, | |
| "template": "red" | |
| }, | |
| "elements": [ | |
| { "tag": "div", "text": { "tag": "lark_md", "content": "**版本:** ${{ needs.publish.outputs.version }}" } }, | |
| { "tag": "div", "text": { "tag": "lark_md", "content": "**日志:** https://github.com/suj1e/larkcc/actions/runs/${{ github.run_id }}" } } | |
| ] | |
| } | |
| }' |