chore: create issue/pull_request markdown template #1
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: Publish to npm | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install pnpm | |
| uses: ./.github/actions/install-pnpm | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20.x" | |
| registry-url: "https://registry.npmjs.org" | |
| cache: pnpm | |
| - run: pnpm install | |
| - run: pnpm run build | |
| - run: npm publish --provenance --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Notify Slack on publish | |
| if: success() | |
| uses: slackapi/slack-github-action@v2 | |
| with: | |
| webhook: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| webhook-type: incoming-webhook | |
| payload: | | |
| { | |
| "text": ":rocket: *commai ${{ github.ref_name }} published to npm*", | |
| "blocks": [ | |
| { | |
| "type": "section", | |
| "text": { | |
| "type": "mrkdwn", | |
| "text": ":rocket: *New release published!*\n*Package:* commai\n*Version:* `${{ github.ref_name }}`\n*Published by:* ${{ github.actor }}\n<https://www.npmjs.com/package/commai|View on npm>" | |
| } | |
| } | |
| ] | |
| } | |
| notify-failure: | |
| name: Notify Slack on failure | |
| runs-on: ubuntu-latest | |
| needs: [publish] | |
| if: failure() | |
| steps: | |
| - uses: slackapi/slack-github-action@v2 | |
| with: | |
| webhook: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| webhook-type: incoming-webhook | |
| payload: | | |
| { | |
| "text": ":x: *Publish failed* for `${{ github.ref_name }}`", | |
| "blocks": [ | |
| { | |
| "type": "section", | |
| "text": { | |
| "type": "mrkdwn", | |
| "text": ":x: *Publish failed* for `${{ github.ref_name }}`\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View run>" | |
| } | |
| } | |
| ] | |
| } |