-
Notifications
You must be signed in to change notification settings - Fork 38
95 lines (85 loc) · 2.92 KB
/
Copy path_changesets-release.yaml
File metadata and controls
95 lines (85 loc) · 2.92 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Changesets Release
on:
workflow_call:
inputs:
release_name:
description: GitHub release name prefix
type: string
default: CCC Release
jobs:
select-mode:
name: Select mode
permissions:
contents: read
runs-on: ubuntu-latest
outputs:
mode: ${{ steps.changesets.outputs.mode }}
release_manifest: ${{ steps.release.outputs.manifest }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 26
- uses: pnpm/action-setup@v6
with:
cache: true
- name: Install dependencies
run: pnpm --filter . install --frozen-lockfile
- name: Select Changesets mode
id: changesets
uses: changesets/action/select-mode@v2
# Keep the full plan in this successful prerequisite when a partial publish is retried.
- name: Collect release manifest
id: release
if: steps.changesets.outputs.mode == 'publish'
run: |
plan="$RUNNER_TEMP/publish-plan.json"
pnpm exec changeset publish-plan --output "$plan"
node -e '
const fs = require("node:fs");
const { plan } = JSON.parse(fs.readFileSync(process.argv[1], "utf8"));
const manifest = plan.flat()
.filter(({ kind }) => kind === "publish")
.map(({ name, version }) => ({ name, version }));
if (manifest.length === 0) {
throw new Error("No packages are waiting to be published");
}
fs.appendFileSync(process.env.GITHUB_OUTPUT, `manifest=${JSON.stringify(manifest)}\n`);
' "$plan"
version:
name: Update release pull request
if: needs.select-mode.outputs.mode == 'version'
needs: select-mode
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 26
- uses: pnpm/action-setup@v6
with:
cache: true
- name: Install dependencies
run: pnpm --filter . install --frozen-lockfile
- name: Create or update release pull request
uses: changesets/action/version@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
pr-title: ${{ format('chore({0}){1} bump packages version', github.ref_name, ':') }}
commit-message: ${{ format('chore({0}){1} bump packages version', github.ref_name, ':') }}
publish:
name: Publish to npm
if: needs.select-mode.outputs.mode == 'publish'
needs: select-mode
uses: ./.github/workflows/_publish-packages.yaml
secrets: inherit
finalize:
name: Finalize release
needs: [select-mode, publish]
uses: ./.github/workflows/_finalize-release.yaml
with:
manifest: ${{ needs.select-mode.outputs.release_manifest }}
release_name: ${{ inputs.release_name }}