Skip to content

Commit 9d16a4f

Browse files
sskirbyclaude
andcommitted
ci: add one-off workflow to mirror existing versions to GitHub Packages
semantic-release only publishes new versions forward, so the older versions current consumers pin (e.g. components 19.1.3 and 15.1.4) won't exist on GitHub Packages. This workflow_dispatch job republishes given npmjs versions to GitHub Packages using the built-in GITHUB_TOKEN, so consumers can switch registries without changing their pinned versions. SPAR-444 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent fc946d5 commit 9d16a4f

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Mirror versions to GitHub Packages
2+
3+
# One-off (SPAR-444): republish existing npmjs versions of this package to
4+
# GitHub Packages. semantic-release only publishes versions forward, so the
5+
# older versions consumers still pin have to be mirrored for them to install
6+
# from GitHub Packages.
7+
8+
on:
9+
workflow_dispatch:
10+
inputs:
11+
versions:
12+
description: "Space-separated npmjs versions to mirror (e.g. 19.1.3 15.1.4)"
13+
required: true
14+
15+
permissions:
16+
packages: write
17+
18+
jobs:
19+
mirror:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/setup-node@v4
23+
with:
24+
node-version: 22
25+
registry-url: https://npm.pkg.github.com
26+
scope: "@nulogy"
27+
- name: Mirror npmjs -> GitHub Packages
28+
env:
29+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
PKG: "@nulogy/components"
31+
VERSIONS: ${{ inputs.versions }}
32+
run: |
33+
set -euo pipefail
34+
for v in $VERSIONS; do
35+
echo "::group::$PKG@$v"
36+
# Pack from npmjs — the @nulogy scope is pointed at GitHub Packages
37+
# for publish, so override it back to npmjs just for the fetch.
38+
tarball=$(npm pack "$PKG@$v" --@nulogy:registry=https://registry.npmjs.org 2>/dev/null | tail -1)
39+
npm publish "$tarball" --access restricted
40+
echo "::endgroup::"
41+
done

0 commit comments

Comments
 (0)