|
| 1 | +name: publish-wt-peer-probes |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*" |
| 7 | + release: |
| 8 | + types: [prereleased, published] |
| 9 | + workflow_dispatch: |
| 10 | + inputs: |
| 11 | + publish_to_npmjs: |
| 12 | + description: Publish @tigrcorn/wt-peer-probes to npmjs. |
| 13 | + type: boolean |
| 14 | + required: false |
| 15 | + default: true |
| 16 | + create_github_release: |
| 17 | + description: Create or update the GitHub release for the probe package. |
| 18 | + type: boolean |
| 19 | + required: false |
| 20 | + default: true |
| 21 | + dry_run: |
| 22 | + description: Run npm publish in dry-run mode. |
| 23 | + type: boolean |
| 24 | + required: false |
| 25 | + default: false |
| 26 | + |
| 27 | +jobs: |
| 28 | + ci: |
| 29 | + name: probe-package-ci |
| 30 | + runs-on: ubuntu-latest |
| 31 | + environment: ci |
| 32 | + permissions: |
| 33 | + contents: read |
| 34 | + steps: |
| 35 | + - name: Check out repository |
| 36 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
| 37 | + - name: Validate WebTransport peer probe package |
| 38 | + uses: cobycloud/actions/actions/setup-node-project@main |
| 39 | + with: |
| 40 | + node-version: "22" |
| 41 | + working-directory: packages/wt-peer-probes |
| 42 | + install-command: npm ci --workspaces=false |
| 43 | + build-command: npm run build --workspaces=false |
| 44 | + test-command: npm test --workspaces=false |
| 45 | + - name: Pack WebTransport peer probe package |
| 46 | + working-directory: packages/wt-peer-probes |
| 47 | + run: npm pack |
| 48 | + - name: Upload WebTransport peer probe tarball |
| 49 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 |
| 50 | + with: |
| 51 | + name: wt-peer-probes-${{ github.sha }} |
| 52 | + path: packages/wt-peer-probes/tigrcorn-wt-peer-probes-*.tgz |
| 53 | + |
| 54 | + github-release: |
| 55 | + name: gh-release |
| 56 | + needs: ci |
| 57 | + if: ${{ github.event_name != 'workflow_dispatch' || inputs.create_github_release }} |
| 58 | + runs-on: ubuntu-latest |
| 59 | + environment: github-release |
| 60 | + permissions: |
| 61 | + contents: write |
| 62 | + steps: |
| 63 | + - name: Check out repository |
| 64 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
| 65 | + - name: Download WebTransport peer probe tarball |
| 66 | + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 |
| 67 | + with: |
| 68 | + name: wt-peer-probes-${{ github.sha }} |
| 69 | + path: .artifacts/wt-peer-probes |
| 70 | + - name: Create or update GitHub release |
| 71 | + uses: cobycloud/actions/actions/github-release@main |
| 72 | + with: |
| 73 | + tag-name: ${{ github.ref_name }} |
| 74 | + name: ${{ github.ref_name }} |
| 75 | + body-path: RELEASE_NOTES_0.3.9.md |
| 76 | + files: .artifacts/wt-peer-probes/*.tgz |
| 77 | + draft: "false" |
| 78 | + prerelease: ${{ github.event_name == 'release' && github.event.release.prerelease }} |
| 79 | + make-latest: legacy |
| 80 | + token: ${{ github.token }} |
| 81 | + |
| 82 | + npmjs: |
| 83 | + name: npmjs-publish |
| 84 | + needs: ci |
| 85 | + if: ${{ github.event_name != 'workflow_dispatch' || inputs.publish_to_npmjs }} |
| 86 | + runs-on: ubuntu-latest |
| 87 | + environment: npm |
| 88 | + permissions: |
| 89 | + contents: read |
| 90 | + id-token: write |
| 91 | + steps: |
| 92 | + - name: Check out repository |
| 93 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
| 94 | + - name: Publish WebTransport peer probe package |
| 95 | + uses: cobycloud/actions/actions/npm-publish@main |
| 96 | + with: |
| 97 | + node-version: "22" |
| 98 | + package-directory: packages/wt-peer-probes |
| 99 | + scope: "@tigrcorn" |
| 100 | + npm-token: ${{ secrets.NPM_TOKEN }} |
| 101 | + install-command: npm ci --workspaces=false |
| 102 | + build-command: npm run build --workspaces=false |
| 103 | + test-command: npm test --workspaces=false |
| 104 | + access: public |
| 105 | + provenance: "true" |
| 106 | + dry-run: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run }} |
0 commit comments