-
Notifications
You must be signed in to change notification settings - Fork 4
DX-809 update to use preferred OIDC for npm publish in github actions #99
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
Changes from all commits
866b0f5
ce2e7d3
0eeb13f
c323558
e10ad9c
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 |
|---|---|---|
|
|
@@ -6,21 +6,31 @@ on: | |
| tags: | ||
| - '*' | ||
|
|
||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
|
|
||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-latest | ||
| environment: release | ||
| env: | ||
| AWS_ACCESS_KEY_ID: ${{ secrets.GIST_WEB_AWS_KEY_ID }} | ||
| AWS_SECRET_ACCESS_KEY: ${{ secrets.GIST_WEB_AWS_SECRET_ACCESS_KEY }} | ||
| AWS_BUCKET: 'gist-code' | ||
| CLOUDFLARE_ACCESS_TOKEN: ${{ secrets.CLOUDFLARE_ACCESS_TOKEN }} | ||
| CLOUDFLARE_ZONE_ID: 3310bc68d22035edbc12d5d4a4fd278c | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: actions/checkout@v4 | ||
lloyd-cio marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - name: Use Node.js ${{ matrix.node-version }} | ||
| uses: actions/setup-node@v2 | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| registry-url: 'https://registry.npmjs.org' | ||
|
|
||
| - name: Install npm 11.5.1+ for OIDC support | ||
| run: npm install -g npm@latest | ||
|
|
||
| - name: Build | ||
| shell: bash | ||
| run: | | ||
|
|
@@ -41,13 +51,12 @@ jobs: | |
| aws_key_id: ${{ env.AWS_ACCESS_KEY_ID }} | ||
| aws_secret_access_key: ${{ env.AWS_SECRET_ACCESS_KEY }} | ||
| aws_bucket: ${{ env.AWS_BUCKET }} | ||
| source_dir: 'dist' | ||
| source_dir: 'dist' | ||
| destination_dir: ${{ env.AWS_DEST }} | ||
| endpoint: 'ams3.digitaloceanspaces.com' | ||
| - name: Publish to NPM | ||
| uses: JS-DevTools/npm-publish@9ff4ebfbe48473265867fb9608c047e7995edfa3 # v3.1.1 | ||
| with: | ||
| token: ${{ secrets.NPM_TOKEN }} | ||
|
Comment on lines
-48
to
-50
Contributor
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. Using standard npm publish to and dropping the no-longer-supported auth tokens - use the OIDC config, instead.
Contributor
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. Any concerns on using the standard |
||
| run: npm publish | ||
|
|
||
| - name: Update Cloudflare rules | ||
| shell: bash | ||
| run: | | ||
|
|
@@ -75,10 +84,9 @@ jobs: | |
| --arg version "$RELEASE_VERSION" \ | ||
| '(.actions[] | select(.id == "forwarding_url") | .value.url) = "https://code.gist.build/web/" + $version + "/gist.min.js"') | ||
|
|
||
|
|
||
| echo "Sending updated rule back to Cloudflare..." | ||
| curl -s -X PUT "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE_ID/pagerules/$RULE_ID" \ | ||
| -H "Authorization: Bearer $CLOUDFLARE_ACCESS_TOKEN" \ | ||
| -H "Content-Type: application/json" \ | ||
| --data "$UPDATED_RULE" | ||
| done | ||
| done | ||
Uh oh!
There was an error while loading. Please reload this page.