-
Notifications
You must be signed in to change notification settings - Fork 54
66 lines (59 loc) · 2.66 KB
/
Copy pathrelease.yml
File metadata and controls
66 lines (59 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Release
# 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:
release:
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 }}