diff --git a/docs/recipes/ci-configurations/github-actions.md b/docs/recipes/ci-configurations/github-actions.md index 03d1db9f..9140f9f1 100644 --- a/docs/recipes/ci-configurations/github-actions.md +++ b/docs/recipes/ci-configurations/github-actions.md @@ -6,6 +6,11 @@ The [Authentication](../../usage/ci-configuration.md#authentication) environment In this example a publish type [`NPM_TOKEN`](https://docs.npmjs.com/creating-and-viewing-authentication-tokens) is required to publish a package to the npm registry. GitHub Actions [automatically populate](https://help.github.com/en/articles/virtual-environments-for-github-actions#github_token-secret) a [`GITHUB_TOKEN`](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line) environment variable which can be used in Workflows. +## npm provenance + +Since GitHub Actions is a [supported provider](https://docs.npmjs.com/generating-provenance-statements#provenance-limitations) for [npm provenance](https://docs.npmjs.com/generating-provenance-statements), it is recommended to enable this to increase supply-chain security for your npm packages. +Find more detail about configuring npm to publish with provenance through semantic-release [in the documentation for our npm plugin](https://github.com/semantic-release/npm#npm-provenance). + ## Node project configuration [GitHub Actions](https://github.com/features/actions) support [Workflows](https://help.github.com/en/articles/configuring-workflows), allowing to run tests on multiple Node versions and publish a release only when all test pass. @@ -23,10 +28,19 @@ on: push: branches: - master + +permissions: + contents: read # for checkout + jobs: release: name: Release runs-on: ubuntu-latest + permissions: + contents: write # to be able to publish a GitHub release + issues: write # to be able to comment on released issues + pull-requests: write # to be able to comment on released pull requests + id-token: write # to enable use of OIDC for npm provenance steps: - name: Checkout uses: actions/checkout@v3 @@ -37,7 +51,9 @@ jobs: with: node-version: "lts/*" - name: Install dependencies - run: npm ci + run: npm clean-install + - name: Verify the integrity of provenance attestations and registry signatures for installed dependencies + run: npm audit signatures - name: Release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}