Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ jobs:
contents: write
issues: write
pull-requests: write
# Lets npm mint a short-lived OIDC token instead of using a long-lived
# NPM_TOKEN. Requires a Trusted Publisher pointing at this workflow file.
# Needed by artifact-publish-token to get temporary Artifactory credentials.
id-token: write
steps:
- name: Checkout Repository
Expand All @@ -30,6 +29,21 @@ jobs:
- name: Build
run: pnpm build

# Publishing goes to Atlassian's Artifactory (see publishConfig in
# package.json), which forwards the package to npmjs.
- name: Get Artifact Publish Token
uses: atlassian-labs/artifact-publish-token@v1.0.1
with:
output-modes: npm

# The action writes ./.npmrc-public, which reads the credentials from
# environment variables. Move it to the user config so pnpm uses it and
# it can't be committed into the release pull request.
- name: Configure Artifactory credentials
run: |
cat .npmrc-public >> ~/.npmrc
rm .npmrc-public

- name: Create Release Pull Request or Publish to NPM
id: changesets
uses: changesets/action@v1
Expand All @@ -39,6 +53,4 @@ jobs:
title: Release Packages
commit: bump versions
env:
# No NPM_TOKEN on purpose: changesets/action writes an .npmrc when it
# sees one, and that credential would take precedence over OIDC.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
run: pnpm build

- name: Test (w/ service)
run: sudo -E ${{ steps.pnpm.outputs.bin_dest }}/pnpm test
run: sudo --preserve-env=CI,VERBOSE,CLOUDFLARED_VERSION,TUNNEL_TOKEN,PNPM_HOME ${{ steps.pnpm.outputs.bin_dest }}/pnpm test
if: matrix.os != 'windows-latest'

- name: Test (w/o service)
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
"lib",
"scripts"
],
"publishConfig": {
"registry": "https://packages.atlassian.com/api/npm/npm-public/"
},
"devDependencies": {
"@atlassian/cloudflared": "workspace:*",
"@changesets/changelog-github": "^0.7.0",
Expand Down
Loading