-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
harden github actions #8650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev-2.0
Are you sure you want to change the base?
harden github actions #8650
Changes from all commits
7a2524b
dcd8ce3
7b4f484
8a3eedf
a4c4bbd
5d668de
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,13 +18,15 @@ jobs: | |
| INPUT_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
| steps: | ||
| # 1. Setup | ||
| - uses: actions/checkout@v3 | ||
| - uses: actions/setup-node@v3 | ||
| - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3 | ||
| with: | ||
| node-version: 22 | ||
| - name: Get semver info | ||
| id: semver | ||
| uses: akshens/semver-tag@v4 | ||
| uses: akshens/semver-tag@8e427cd48c699c97d021df4946f3a0e65af5047e # v4 | ||
| with: | ||
| version: ${{ github.ref_name }} | ||
|
|
||
|
|
@@ -57,7 +59,7 @@ jobs: | |
| # 2. Prepare release files | ||
| - run: mkdir release && mkdir p5 && cp -r ./lib/* p5/ | ||
| - name: Create release zip file | ||
| uses: TheDoctor0/zip-release@0.6.2 | ||
| uses: TheDoctor0/zip-release@09336613be18a8208dfa66bd57efafd9e2685657 # 0.6.2 | ||
| with: | ||
| type: zip | ||
| filename: release/p5.zip | ||
|
|
@@ -68,29 +70,30 @@ jobs: | |
|
|
||
| # 3. Release p5.js | ||
| - name: Create GitHub release | ||
| uses: softprops/action-gh-release@v0.1.15 | ||
| uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15 | ||
| with: | ||
| draft: true | ||
| prerelease: ${{ steps.semver.outputs.is-prerelease == 'true' }} | ||
| files: release/* | ||
| generate_release_notes: true | ||
| token: ${{ secrets.ACCESS_TOKEN }} | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @perminder-17 I don't think the token should change (or, why should it?)
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In Step 3
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah sure! Then |
||
| - name: Publish to NPM | ||
| uses: JS-DevTools/npm-publish@v1 | ||
| uses: JS-DevTools/npm-publish@0f451a94170d1699fd50710966d48fb26194d939 | ||
| with: | ||
| token: ${{ secrets.NPM_TOKEN }} | ||
| tag: ${{ steps.semver.outputs.is-prerelease != 'true' && 'latest' || 'beta' }} | ||
|
|
||
| # 4. Update p5.js website | ||
| - name: Clone p5.js website | ||
| if: ${{ steps.semver.outputs.is-prerelease != 'true' }} | ||
| uses: actions/checkout@v3 | ||
| uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 | ||
| with: | ||
| repository: processing/p5.js-website | ||
| ref: '2.0' | ||
| path: website | ||
| fetch-depth: 0 | ||
| token: ${{ secrets.ACCESS_TOKEN }} | ||
| persist-credentials: false | ||
| - name: Updated website files | ||
| if: ${{ steps.semver.outputs.is-prerelease != 'true' }} | ||
| run: | | ||
|
|
@@ -111,7 +114,7 @@ jobs: | |
| git commit -m "Update p5.js to ${{ github.ref_name }}" | ||
| - name: Push updated website repo | ||
| if: ${{ steps.semver.outputs.is-prerelease != 'true' }} | ||
| uses: ad-m/github-push-action@v0.6.0 | ||
| uses: ad-m/github-push-action@40bf560936a8022e68a3c00e7d2abefaf01305a6 # v0.6.0 | ||
| with: | ||
| github_token: ${{ secrets.ACCESS_TOKEN }} | ||
| branch: '2.0' | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://about.codecov.io/apr-2021-post-mortem/
This actually happened in real life in 2021, Codecov's bash uploader was compromised and attackers stole secrets/tokens from thousands of CI pipelines. @ksen0 @davepagurek @limzykenneth
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're not really utilizing it at the moment so it probably can be skipped entirely. We'll do code coverage in Vitest for 2.x at some point and reporting can either use a service like this or even our own bot.