Skip to content

Commit aa86221

Browse files
authored
Trigger canary on new release (#22)
1 parent 24e66bb commit aa86221

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

.github/workflows/test-node.yml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,38 @@ on:
33
push:
44
branches:
55
- main
6+
tags: # To trigger the canary
7+
- '*'
68
pull_request:
79
branches:
810
- main
11+
912
jobs:
1013
build:
14+
if: ${{ !startsWith(github.ref, 'refs/tags/')}} # Already runs for the push of the commit, no need to run again for the tag
1115
strategy:
1216
matrix:
1317
node-version: [lts/*]
1418
os: [ubuntu-latest, macos-latest, windows-latest]
1519
runs-on: ${{ matrix.os }}
1620
steps:
17-
- uses: actions/checkout@v2
18-
- name: Use Node.js ${{ matrix.node-version }}
19-
uses: actions/setup-node@v2
20-
with:
21-
node-version: ${{ matrix.node-version }}
22-
- run: npm install
23-
- run: npm test
21+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 https://github.com/actions/checkout/releases/tag/v4.1.1
22+
- name: Use Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2 https://github.com/actions/setup-node/releases/tag/v3.8.2
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
- run: npm install
27+
- run: npm test
28+
29+
trigger_canary:
30+
if: startsWith(github.ref, 'refs/tags/') # Only run when a new package is published (detects when a new tag is pushed)
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: trigger canary
34+
run: |
35+
curl -L -X POST \
36+
-H "Accept: application/vnd.github+json" \
37+
-H "Authorization: Bearer ${{ secrets.CANARY_DISPATCH_PAT }}" \
38+
-H "X-GitHub-Api-Version: 2022-11-28" \
39+
https://api.github.com/repos/holepunchto/canary-tests/dispatches \
40+
-d '{"event_type":"triggered-by-${{ github.event.repository.name }}-${{ github.ref_name }}"}'

0 commit comments

Comments
 (0)