44 branches :
55 - master
66 - develop
7+ workflow_dispatch :
8+ inputs :
9+ snapshot_tag :
10+ description : ' changesets snapshot tag (beta/canary)'
11+ required : false
12+ default : ' beta'
13+ type : string
14+ npm_tag :
15+ description : ' npm tag for publishing snapshot'
16+ required : false
17+ default : ' beta'
18+ type : string
19+ npm_access :
20+ description : ' access level for publishing snapshot to npm'
21+ required : false
22+ default : ' public'
23+ type : choice
24+ options :
25+ - public
26+ - restricted
727env :
828 NX_CLOUD_ENCRYPTION_KEY : ${{ secrets.NX_CLOUD_ENCRYPTION_KEY }}
929 NX_CLOUD_ACCESS_TOKEN : ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
10- NX_CLOUD_DISTRIBUTED_EXECUTION : true
11- PNPM_CACHE_FOLDER : .pnpm-store
12- NPM_ACCESS_TOKEN : ${{ secrets.NPM_ACCESS_TOKEN }}
1330 HUSKY : 0
31+ CI : true
1432
1533jobs :
34+ # On push to develop/master, create or update release PR or publish to npm
1635 publish-or-pr :
36+ if : github.event_name == 'push'
37+ name : Create/update release PR or publish to npm
1738 permissions :
1839 contents : write # to create release (changesets/action)
1940 issues : write # to post issue comments (changesets/action)
2041 pull-requests : write # to create pull request (changesets/action)
21- id-token : write # give id token write for provenance
42+ id-token : write # OIDC for provenance if npm publish happens here
2243 runs-on : ubuntu-latest
2344 steps :
24- - uses : actions/checkout@v4
45+ - name : Setup publish
46+ uses : ./.github/actions/setup-publish
2547 with :
26- fetch-depth : 0
27- - uses : pnpm/action-setup@v4
28- with :
29- run_install : false
30- - uses : actions/setup-node@v4
31- id : cache
32- with :
33- node-version : ' 20.10.0'
34- cache : ' pnpm'
35-
36- - run : pnpm install --frozen-lockfile
37-
38- # This line enables distribution
39- # The "--stop-agents-after" is optional, but allows idle agents to shut down once the "e2e-ci" targets have been requested
40- - run : pnpm dlx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="e2e-ci" --verbose
41-
42- - run : pnpm exec playwright install
43-
44- - uses : nrwl/nx-set-shas@v4
45- with :
46- main-branch-name : master
48+ branch : ${{ github.ref_name }}
4749
48- - name : setup pnpm config
49- run : pnpm config set store-dir $PNPM_CACHE_FOLDER
50-
51- - run : pnpm exec nx affected -t build lint test e2e-ci --verbose
52-
53- - uses : actions/upload-artifact@v4
54- if : ${{ !cancelled() }}
55- with :
56- name : playwright-report
57- path : |
58- ./dist/.playwright/**
59- ./dist/**
60- retention-days : 30
61-
62- # make sure we have a build.
63- - run : pnpm exec nx run-many -t build
64- env :
65- NX_CLOUD_DISTRIBUTED_EXECUTION : false
66-
67- - run : git status
68- - name : publish
50+ # This action creates a release pull request with all of
51+ # the package versions and changelogs updated. When there
52+ # are new changesets on your configured baseBranch, the PR will
53+ # be updated. When you're ready, you can merge the release PR
54+ # and the action will publish to npm for you.
55+ # https://github.com/changesets/action
56+ - name : Create/update release PR or publish to npm
6957 uses : changesets/action@v1
7058 id : changesets
7159 with :
72- publish : pnpm ci:release
73- version : pnpm ci:version
74- title : Release PR
75- branch : master
76- commit : ' chore: version-packages'
60+ publish : pnpm ci:release # command to tag and publish packages
61+ version : pnpm ci:version # command to update version, edit changelog, read and delete changesets
62+ title : Release PR # title for the release PR
63+ commit : ' chore: version-packages' # the commit message to use
7764 setupGitUser : true
7865 env :
79- # See https://github.com/changesets/action/issues/147
80- HOME : ${{ github.workspace }}
66+ HOME : ${{ github.workspace }} # See https://github.com/changesets/action/issues/147
8167 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
8268 NPM_CONFIG_PROVENANCE : ' true'
8369 NPM_TOKEN : ${{ secrets.NPM_ACCESS_TOKEN }}
8470
85- - name : rebase develop with main on publish
86- if : ${{ steps.changesets.outputs.published == 'true' }}
71+ - name : Publish previews to Stackblitz on PR
72+ if : steps.changesets.outputs.published == 'false'
73+ run : pnpm pkg-pr-new publish './packages/*' --packageManager=pnpm --comment=off
74+
75+ - name : Rebase develop with master on publish
76+ if : steps.changesets.outputs.published == 'true'
8777 run : |
8878 git restore .
8979 git checkout master
@@ -95,10 +85,52 @@ jobs:
9585 git rebase master
9686 git push -f
9787 env :
98- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
99- NPM_CONFIG_PROVENANCE : true
88+ GITHUB_TOKEN : ${{ secrets.GH_TOKEN }}
89+
90+ - name : Send GitHub Action data to a Slack workflow
91+ if : steps.changesets.outputs.published == 'true'
92+ 93+ with :
94+ payload-delimiter : ' _'
95+ webhook : ${{ secrets.SLACK_WEBHOOK_URL }}
96+ webhook-type : webhook-trigger
97+ payload : |
98+ text: ${{ steps.changesets.outputs.publishedPackages }}
10099
101- - uses : codecov/codecov-action@v5
100+ - name : Run code coverage
101+ uses : codecov/codecov-action@v5
102102 with :
103103 files : ./packages/**/coverage/*.xml
104104 token : ${{ secrets.CODECOV_TOKEN }}
105+
106+ snapshot :
107+ # On manual trigger of GH action, publish a snapshot release to npm
108+ if : github.event_name == 'workflow_dispatch'
109+ name : Publish snapshot/beta release to npm
110+ permissions :
111+ contents : read
112+ id-token : write # OIDC for provenance when npm publish happens
113+ runs-on : ubuntu-latest
114+ steps :
115+ - name : Setup publish
116+ uses : ./.github/actions/setup-publish
117+ with :
118+ branch : ${{ github.ref_name }}
119+
120+ - name : Version packages for snapshot
121+ run : pnpm changeset version --snapshot ${{ inputs.snapshot_tag }}
122+ env :
123+ GITHUB_TOKEN : ${{ secrets.GH_TOKEN }}
124+
125+ - name : Publish packages snapshot with npm_tag
126+ run : pnpm publish -r --tag ${{ inputs.npm_tag }} --no-git-checks --access ${{ inputs.npm_access }}
127+
128+ - name : Send GitHub Action data to a Slack workflow
129+ if : steps.changesets.outputs.published == 'true'
130+ 131+ with :
132+ payload-delimiter : ' _'
133+ webhook : ${{ secrets.SLACK_WEBHOOK_URL }}
134+ webhook-type : webhook-trigger
135+ payload : |
136+ text: ${{ steps.changesets.outputs.publishedPackages }}
0 commit comments