Skip to content
Open
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
13 changes: 11 additions & 2 deletions .github/workflows/publish_next_compute-baseline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
paths:
- packages/compute-baseline/**

permissions: {}

Comment on lines +10 to +11
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The permissions vary between jobs here, so this explicitly unsets them for the workflow.

env:
package: "compute-baseline"
package_dir: "packages/compute-baseline"
Expand All @@ -15,6 +17,8 @@ env:
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
Expand All @@ -27,6 +31,12 @@ jobs:
if: github.repository == 'web-platform-dx/web-features'
runs-on: ubuntu-latest
needs: "test"
permissions:
contents: read
# Required for OIDC and trusted publishing. See:
# - https://docs.npmjs.com/trusted-publishers
# - https://docs.github.com/en/actions/concepts/security/openid-connect
id-token: write
steps:
- name: Get timestamp
id: timestamp
Expand All @@ -37,6 +47,7 @@ jobs:
node-version-file: .node-version
cache: npm
registry-url: "https://registry.npmjs.org"
- run: npm install -g 'npm@>=11.5.1 # required for trusted publishing
- run: npm ci
- name: Get package.json version
id: version
Expand All @@ -49,5 +60,3 @@ jobs:
VERSION: ${{ steps.version.outputs.VERSION }}
TIMESTAMP: ${{ steps.timestamp.outputs.TIMESTAMP }}
- run: npm publish --workspace=${{ env.package }} --tag ${{ env.dist_tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
18 changes: 12 additions & 6 deletions .github/workflows/publish_next_web-features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ on:
- index.ts
- scripts/build.ts

permissions:
contents: write
permissions: {}

env:
package: "web-features"
Expand All @@ -23,6 +22,8 @@ env:
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
Expand All @@ -35,6 +36,12 @@ jobs:
if: github.repository == 'web-platform-dx/web-features'
runs-on: ubuntu-latest
needs: "test"
permissions:
contents: write
# Required for OIDC and trusted publishing. See:
# - https://docs.npmjs.com/trusted-publishers
# - https://docs.github.com/en/actions/concepts/security/openid-connect
id-token: write
steps:
- uses: actions/checkout@v6
- name: Get timestamp and short hash
Expand All @@ -48,6 +55,8 @@ jobs:
node-version-file: .node-version
cache: npm
registry-url: "https://registry.npmjs.org"

- run: npm install -g 'npm@>=11.5.1' # required for trusted publishing
- run: npm ci

- run: npm run build
Expand All @@ -67,11 +76,8 @@ jobs:
VERSION: ${{ steps.version.outputs.VERSION }}
TIMESTAMP: ${{ steps.timestamp_and_hash.outputs.TIMESTAMP }}
SHORT_HASH: ${{ steps.timestamp_and_hash.outputs.SHORT_HASH }}
- if: ${{ env.NODE_AUTH_TOKEN }}
run: npm publish --tag ${{ env.dist_tag }}
- run: npm publish --tag ${{ env.dist_tag }}
working-directory: ${{ env.package_dir }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Comment on lines -70 to -74
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The token is no longer required (and the if condition was superfluous anyway, in light of the if: github.repository … condition for the entire job).


- name: Set existing release to draft
run: gh release edit --draft "$TAG"
Expand Down