@@ -15,22 +15,36 @@ concurrency:
1515permissions : {} # each job should define its own permission explicitly
1616
1717jobs :
18- version :
19- name : Version
18+ select-mode :
19+ name : Select Mode
2020 runs-on : ubuntu-latest
2121 environment : version
2222 timeout-minutes : 10
2323 outputs :
24- hasChangesets : ${{ steps.changesets.outputs.hasChangesets }}
24+ mode : ${{ steps.select-mode.outputs.mode }}
25+ publish-plan-artifact-id : ${{ steps.select-mode.outputs.publish-plan-artifact-id }}
2526 permissions :
2627 contents : read # to check out repo (actions/checkout)
2728 steps :
28- - name : Check out repo
29- uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
29+ - uses : $/.github/actions/ci-setup
3030 with :
31- persist-credentials : false
31+ skip-cache : true # avoid cache poisoning attacks
32+
33+ - name : Select mode
34+ id : select-mode
35+ uses : changesets/action/select-mode@22ccf9aa43179fe9e27dc62e575971d28cce197c # v2.0.0
3236
33- - uses : ./.github/actions/ci-setup
37+ version :
38+ name : Version
39+ needs : select-mode
40+ if : needs.select-mode.outputs.mode == 'version'
41+ runs-on : ubuntu-latest
42+ environment : version
43+ timeout-minutes : 10
44+ permissions :
45+ contents : read # to check out repo (actions/checkout)
46+ steps :
47+ - uses : $/.github/actions/ci-setup
3448 with :
3549 skip-cache : true # avoid cache poisoning attacks
3650
@@ -44,33 +58,50 @@ jobs:
4458
4559 - name : Create or update release pull request
4660 id : changesets
47- uses : changesets/action@a45c4d594aa4e2c509dc14a9f2b3b67ba3780d0d # v1.9 .0
61+ uses : changesets/action/version@22ccf9aa43179fe9e27dc62e575971d28cce197c # v2.0 .0
4862 with :
4963 github-token : ${{ steps.app-token.outputs.token }}
50- version : pnpm version-packages
64+ script : pnpm version-packages
65+
66+ pack :
67+ name : Pack
68+ needs : select-mode
69+ if : needs.select-mode.outputs.mode == 'publish'
70+ runs-on : ubuntu-latest
71+ timeout-minutes : 10
72+ outputs :
73+ pack-dir-artifact-id : ${{ steps.pack.outputs.pack-dir-artifact-id }}
74+ permissions :
75+ contents : read # to check out repo (actions/checkout)
76+ steps :
77+ - uses : $/.github/actions/ci-setup
78+ with :
79+ skip-cache : true # avoid cache poisoning attacks
80+
81+ - name : Build
82+ run : pnpm build
83+
84+ - name : Pack
85+ id : pack
86+ uses : changesets/action/pack@22ccf9aa43179fe9e27dc62e575971d28cce197c # v2.0.0
87+ with :
88+ publish-plan-artifact-id : ${{ needs.select-mode.outputs.publish-plan-artifact-id }}
5189
5290 publish :
5391 name : Publish
54- if : needs.version.outputs.hasChangesets == 'false'
55- needs : version
92+ needs : pack
5693 runs-on : ubuntu-latest
5794 environment : npm
5895 timeout-minutes : 10
5996 permissions :
6097 contents : write # to create release (changesets/action)
6198 id-token : write # to use OpenID Connect token for trusted publishing (changesets/action)
6299 steps :
63- - name : Check out repo
64- uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
65- with :
66- persist-credentials : false
67-
68- - uses : ./.github/actions/ci-setup
100+ - uses : $/.github/actions/ci-setup
69101 with :
70102 skip-cache : true # avoid cache poisoning attacks
71103
72104 - name : Publish to npm
73- uses : changesets/action@a45c4d594aa4e2c509dc14a9f2b3b67ba3780d0d # v1.9 .0
105+ uses : changesets/action/publish@22ccf9aa43179fe9e27dc62e575971d28cce197c # v2.0 .0
74106 with :
75- publish : pnpm release
76- commitMode : github-api
107+ pack-dir-artifact-id : ${{ needs.pack.outputs.pack-dir-artifact-id }}
0 commit comments