@@ -11,22 +11,22 @@ jobs:
1111 runs-on : ${{ matrix.os }}
1212 steps :
1313 - name : 📥 Checkout repository
14- uses : actions/checkout@v3
14+ uses : actions/checkout@v4
1515 with :
1616 # Fetch all history for all tags and branches
1717 fetch-depth : 0
1818 ref : master
1919 token : ${{ secrets.BOT_GH_TOKEN }}
2020
2121 - name : 🧰 Setup Node.js
22- uses : actions/setup-node@v1
22+ uses : actions/setup-node@v4
2323 with :
2424 node-version : 18.12.0
2525 registry-url : ' https://registry.npmjs.org'
2626
2727 - name : Import bot's GPG key for signing commits
2828 id : import-gpg
29- uses : crazy-max/ghaction-import-gpg@v5
29+ uses : crazy-max/ghaction-import-gpg@v6
3030 with :
3131 gpg_private_key : ${{ secrets.BOT_GPG_KEY }}
3232 git_config_global : true
@@ -44,11 +44,24 @@ jobs:
4444 run : |
4545 yarn build
4646
47- - name : Publish
47+ # Phase 1 — decide versions, commit, tag, push to master, and create GitHub Releases.
48+ # No-ops when there are no new conventional commits (e.g. re-running after a publish
49+ # failure), so it never double-bumps an already-versioned release.
50+ - name : 🏷️ Version
4851 run : |
49- if [ $RELEASE_MODE = "stable" ]; then yarn publish :stable; else yarn publish :rc; fi
52+ if [ " $RELEASE_MODE" = "stable" ]; then yarn version :stable; else yarn version :rc; fi
5053 env :
51- NODE_AUTH_TOKEN : ${{ secrets.NPM_REGISTRY_TOKEN }}
5254 # Used for making a GitHub Release
5355 GH_TOKEN : ${{ secrets.BOT_GH_TOKEN }}
5456 RELEASE_MODE : ${{ vars.RELEASE_MODE }}
57+
58+ # Phase 2 — publish to npm via `lerna publish from-package`, which queries the registry
59+ # and publishes ONLY versions that are not yet there. This makes the job idempotent and
60+ # recoverable: if a previous run versioned/tagged but failed to publish, simply re-running
61+ # the workflow ships the missing packages without touching git history.
62+ - name : 📦 Publish to npm
63+ run : |
64+ if [ "$RELEASE_MODE" = "stable" ]; then yarn publish:stable; else yarn publish:rc; fi
65+ env :
66+ NODE_AUTH_TOKEN : ${{ secrets.NPM_REGISTRY_TOKEN }}
67+ RELEASE_MODE : ${{ vars.RELEASE_MODE }}
0 commit comments