Publish #88
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish | |
| # This workflow drives releases with Changesets. | |
| # | |
| # On every push to `main` it runs `changesets/action`, which behaves in one of two ways: | |
| # * If there are pending changeset files, it opens/updates a "Version Packages" PR that bumps the | |
| # version and writes CHANGELOG.md. | |
| # * If there are no pending changesets (i.e. the "Version Packages" PR was just merged), it runs | |
| # `changeset publish`, which publishes to npm (via npm OIDC trusted publishing), creates the git | |
| # tag, and cuts a GitHub Release. | |
| on: | |
| push: | |
| # For security reasons, this should never be set to anything but `main` | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| # Serialize releases. `cancel-in-progress: false` so a mid-publish run is never | |
| # killed by a newer push. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| # Never attempt to publish from forks (no trusted-publisher match / secrets). | |
| if: github.repository == 'nodejs/doc-kit' | |
| permissions: | |
| contents: write # commit the version bump, push the git tag, create the GitHub Release | |
| pull-requests: write # open/update the "Version Packages" PR | |
| # For npm OIDC (https://docs.npmjs.com/trusted-publishers) | |
| id-token: write | |
| steps: | |
| - name: Setup environment | |
| uses: nodejs/web-team/actions/setup-environment@9f3c83af227d721768d9dbb63009a47ed4f4282f | |
| with: | |
| use-version-file: true | |
| registry-url: 'https://registry.npmjs.org' | |
| fetch-depth: 0 | |
| - name: Create Release Pull Request or Publish | |
| id: changesets | |
| uses: changesets/action@a45c4d594aa4e2c509dc14a9f2b3b67ba3780d0d # v1.9.0 | |
| with: | |
| version: node --run changeset:version | |
| publish: node --run release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Notify | |
| if: steps.changesets.outputs.published == 'true' | |
| uses: rtCamp/action-slack-notify@33ca3be66c6f378fe1610fd1d5258632dbed5e58 # v2.4.0 | |
| env: | |
| SLACK_COLOR: '#43853D' | |
| SLACK_ICON: https://github.com/nodejs.png?size=48 | |
| SLACK_TITLE: ':rocket: Package Published: @node-core/doc-kit' | |
| SLACK_MESSAGE: | | |
| :package: *Package*: `@node-core/doc-kit` (<https://www.npmjs.com/package/@node-core/doc-kit|View on npm>) | |
| :bust_in_silhouette: *Published by*: ${{ github.triggering_actor }} | |
| :octocat: *Commit*: <https://github.com/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}> | |
| SLACK_USERNAME: nodejs-bot | |
| SLACK_CHANNEL: nodejs-web-infra-alerts | |
| SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }} |