Skip to content

Commit a5c2edd

Browse files
committed
ci: add stub action for canary releases on PRs
Based on https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
1 parent f597c69 commit a5c2edd

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

.github/workflows/canary.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Canary Release
2+
on:
3+
workflow_run:
4+
workflows:
5+
- CI
6+
types:
7+
- completed
8+
env:
9+
NODE_VERSION_USED_FOR_DEVELOPMENT: 17
10+
jobs:
11+
publish-canary:
12+
runs-on: ubuntu-latest
13+
name: Publish Canary
14+
if: ${{ github.event.workflow_run.event == 'pull_request' }}
15+
steps:
16+
- name: Dump GitHub context
17+
run: echo "$GITHUB_CONTEXT"
18+
env:
19+
GITHUB_CONTEXT: ${{ toJson(github) }}

.github/workflows/ci.yml

+28
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,34 @@ jobs:
236236
path: ./npm-dist-diff.html
237237
if-no-files-found: ignore
238238

239+
build-npm-package:
240+
name: Build artifact with NPM package
241+
runs-on: ubuntu-latest
242+
needs: [test, fuzz, lint, integrationTests]
243+
steps:
244+
- name: Checkout repo
245+
uses: actions/checkout@v2
246+
with:
247+
persist-credentials: false
248+
249+
- name: Setup Node.js
250+
uses: actions/setup-node@v2
251+
with:
252+
cache: npm
253+
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}
254+
255+
- name: Install Dependencies
256+
run: npm ci --ignore-scripts
257+
258+
- name: Build NPM package
259+
run: npm run build:npm
260+
261+
- name: Upload NPM package
262+
uses: actions/upload-artifact@v2
263+
with:
264+
name: npmDist
265+
path: ./npmDist
266+
239267
deploy-to-npm-branch:
240268
name: Deploy to `npm` branch
241269
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)