Skip to content

Commit b4bb5f3

Browse files
committed
build(ci): pre publish
1 parent d67fa43 commit b4bb5f3

File tree

4 files changed

+66
-2
lines changed

4 files changed

+66
-2
lines changed

.github/workflows/publish-alpha.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@ permissions:
88
id-token: write # to enable use of OIDC for npm provenance
99

1010
jobs:
11+
pre-publish:
12+
if: github.ref == 'refs/heads/develop'
13+
uses: ./.github/workflows/publish-dry-run.yml
14+
secrets:
15+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1116
publish:
17+
needs: pre-publish
1218
runs-on: ubuntu-latest
1319
environment: development
1420
# restricts job to develop branch
@@ -44,7 +50,7 @@ jobs:
4450
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4551

4652
- name: Publish Alpha
47-
run: yarn multi-semantic-release --deps.bump=override --deps.release=patch --sequential-init
53+
run: yarn multi-semantic-release
4854
env:
4955
NPM_CONFIG_PROVENANCE: true
5056
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/publish-dry-run.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Publish Dry Run
2+
on:
3+
workflow_dispatch:
4+
workflow_call:
5+
secrets:
6+
NPM_TOKEN:
7+
description: 'NPM token'
8+
required: true
9+
10+
jobs:
11+
publish-dry-run:
12+
runs-on: ubuntu-latest
13+
environment: development
14+
steps:
15+
- name: Checkout repo
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
persist-credentials: false
20+
21+
- name: Setup Node
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: 20
25+
cache: 'yarn'
26+
27+
- name: Install dependencies
28+
run: yarn --immutable
29+
30+
- name: Build
31+
run: yarn build:packages
32+
33+
- name: Dry run Publish
34+
run: yarn multi-semantic-release --dry-run --silent | grep -E '#|###|\*' > dry_run_output.txt
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
38+
39+
- name: Write results to summary
40+
run: |
41+
if [ -s dry_run_output.txt ]; then
42+
echo "# Packages to be published:" >> $GITHUB_STEP_SUMMARY
43+
cat dry_run_output.txt >> $GITHUB_STEP_SUMMARY
44+
else
45+
echo "Nothing will be published" >> $GITHUB_STEP_SUMMARY
46+
fi

.github/workflows/publish.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ permissions:
1010
id-token: write # to enable use of OIDC for npm provenance
1111

1212
jobs:
13+
pre-publish:
14+
uses: ./.github/workflows/publish-dry-run.yml
15+
secrets:
16+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1317
publish:
18+
needs: pre-publish
1419
runs-on: ubuntu-latest
1520
environment: production
1621
steps:
@@ -44,7 +49,7 @@ jobs:
4449
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4550

4651
- name: Publish
47-
run: yarn multi-semantic-release --deps.bump=override --deps.release=patch --sequential-init
52+
run: yarn multi-semantic-release
4853
env:
4954
NPM_CONFIG_PROVENANCE: true
5055
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

package.json

+7
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@
6868
}
6969
]
7070
},
71+
"multi-release": {
72+
"sequentialInit": true,
73+
"deps": {
74+
"bump": "override",
75+
"release": "patch"
76+
}
77+
},
7178
"packageManager": "[email protected]",
7279
"engines": {
7380
"node": ">=20"

0 commit comments

Comments
 (0)