-
-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (56 loc) · 2 KB
/
Copy pathrelease.yml
File metadata and controls
65 lines (56 loc) · 2 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
name: release
# Changesets-driven release for a khai plays house.
#
# On every push to main:
# * If unreleased changeset files exist, the action opens/updates a
# "Version Packages" PR that bumps the version and writes the CHANGELOG.
# Merging that PR consumes the changesets.
# * If there are no pending changesets (the version PR was just merged),
# the action runs `changeset publish`, which publishes the house package
# to GitHub Packages and pushes its git tag.
#
# ── Token requirements ───────────────────────────────────────────────────────
# RELEASE_TOKEN must be a PAT with:
# * Contents: Read and write (push the changeset-release/main branch + tags)
# * Pull requests: Read and write (open the Version PR)
# The built-in GITHUB_TOKEN cannot drive the git pushes here: GitHub suppresses
# workflow runs on commits made by GITHUB_TOKEN (anti-recursion), so the Version
# PR would never get CI and could never be merged green.
on:
push:
branches: [main]
concurrency: release-${{ github.ref }}
permissions:
contents: write
pull-requests: write
packages: write
jobs:
release:
runs-on: ubuntu-latest
env:
HUSKY: "0"
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_TOKEN }}
- uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
registry-url: "https://npm.pkg.github.com"
scope: "@chbrain"
cache: "npm"
- name: install
run: npm ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: test
run: npm test
- name: changesets release
uses: changesets/action@v1
with:
version: npm run version
publish: npm run release
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}