-
-
Notifications
You must be signed in to change notification settings - Fork 10
107 lines (94 loc) · 3.27 KB
/
Copy pathpublish.yml
File metadata and controls
107 lines (94 loc) · 3.27 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
96
97
98
99
100
101
102
103
104
105
106
107
name: Publish
on:
push:
branches:
- main
- next
- "maintenance/v*" # branch rulesets don't support v[0-9]+
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
queue: max
permissions: {} # each job should define its own permission explicitly
jobs:
select-mode:
name: Select Mode
runs-on: ubuntu-latest
environment: version
timeout-minutes: 10
outputs:
mode: ${{ steps.select-mode.outputs.mode }}
publish-plan-artifact-id: ${{ steps.select-mode.outputs.publish-plan-artifact-id }}
permissions:
contents: read # to check out repo (actions/checkout)
steps:
- uses: $/.github/actions/ci-setup
with:
skip-cache: true # avoid cache poisoning attacks
- name: Select mode
id: select-mode
uses: changesets/action/select-mode@22ccf9aa43179fe9e27dc62e575971d28cce197c # v2.0.0
version:
name: Version
needs: select-mode
if: needs.select-mode.outputs.mode == 'version'
runs-on: ubuntu-latest
environment: version
timeout-minutes: 10
permissions:
contents: read # to check out repo (actions/checkout)
steps:
- uses: $/.github/actions/ci-setup
with:
skip-cache: true # avoid cache poisoning attacks
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
id: app-token
with:
client-id: ${{ vars.APP_CLIENT_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
permission-contents: write # to create version commits (changesets/action)
permission-pull-requests: write # to create pull request (changesets/action)
- name: Create or update release pull request
id: changesets
uses: changesets/action/version@22ccf9aa43179fe9e27dc62e575971d28cce197c # v2.0.0
with:
github-token: ${{ steps.app-token.outputs.token }}
script: pnpm version-packages
pack:
name: Pack
needs: select-mode
if: needs.select-mode.outputs.mode == 'publish'
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
pack-dir-artifact-id: ${{ steps.pack.outputs.pack-dir-artifact-id }}
permissions:
contents: read # to check out repo (actions/checkout)
steps:
- uses: $/.github/actions/ci-setup
with:
skip-cache: true # avoid cache poisoning attacks
- name: Build
run: pnpm build
- name: Pack
id: pack
uses: changesets/action/pack@22ccf9aa43179fe9e27dc62e575971d28cce197c # v2.0.0
with:
publish-plan-artifact-id: ${{ needs.select-mode.outputs.publish-plan-artifact-id }}
publish:
name: Publish
needs: pack
runs-on: ubuntu-latest
environment: npm
timeout-minutes: 10
permissions:
contents: write # to create release (changesets/action)
id-token: write # to use OpenID Connect token for trusted publishing (changesets/action)
steps:
- uses: $/.github/actions/ci-setup
with:
skip-cache: true # avoid cache poisoning attacks
- name: Publish to npm
uses: changesets/action/publish@22ccf9aa43179fe9e27dc62e575971d28cce197c # v2.0.0
with:
pack-dir-artifact-id: ${{ needs.pack.outputs.pack-dir-artifact-id }}