|
42 | 42 | if: github.event_name == 'repository_dispatch' && github.event.action == 'npm-publish-release' |
43 | 43 | runs-on: ubuntu-latest |
44 | 44 | steps: |
| 45 | + - name: Set pending commit status |
| 46 | + if: ${{ github.event.client_payload.ref != '' }} |
| 47 | + env: |
| 48 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 49 | + SHA: ${{ github.event.client_payload.ref }} |
| 50 | + run: | |
| 51 | + gh api repos/${{ github.repository }}/statuses/$SHA \ |
| 52 | + -f state=pending \ |
| 53 | + -f context=npm-publish-release \ |
| 54 | + -f description="Publishing release to npm..." \ |
| 55 | + -f target_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" |
| 56 | +
|
45 | 57 | - name: Checkout sources |
46 | 58 | uses: actions/checkout@v6 |
47 | 59 |
|
|
62 | 74 | NPM_TAG: ${{ github.event.client_payload.tag || 'latest-rc' }} |
63 | 75 | run: npm publish --provenance --access public --tag "$NPM_TAG" |
64 | 76 |
|
| 77 | + - name: Set success commit status |
| 78 | + if: ${{ success() && github.event.client_payload.ref != '' }} |
| 79 | + env: |
| 80 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 81 | + SHA: ${{ github.event.client_payload.ref }} |
| 82 | + run: | |
| 83 | + gh api repos/${{ github.repository }}/statuses/$SHA \ |
| 84 | + -f state=success \ |
| 85 | + -f context=npm-publish-release \ |
| 86 | + -f description="Release published to npm" \ |
| 87 | + -f target_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" |
| 88 | +
|
| 89 | + - name: Set failure commit status |
| 90 | + if: ${{ failure() && github.event.client_payload.ref != '' }} |
| 91 | + env: |
| 92 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 93 | + SHA: ${{ github.event.client_payload.ref }} |
| 94 | + run: | |
| 95 | + gh api repos/${{ github.repository }}/statuses/$SHA \ |
| 96 | + -f state=failure \ |
| 97 | + -f context=npm-publish-release \ |
| 98 | + -f description="Failed to publish release" \ |
| 99 | + -f target_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" |
| 100 | +
|
65 | 101 | publish-dev: |
66 | 102 | if: github.event_name == 'repository_dispatch' && github.event.action == 'npm-publish-dev' |
67 | 103 | runs-on: ubuntu-latest |
|
0 commit comments