1313 publish :
1414 runs-on : ubuntu-latest
1515 permissions :
16- contents : read
17- packages : write
16+ contents : write
1817
1918 steps :
2019 - name : Checkout
2423 uses : actions/setup-node@v4
2524 with :
2625 node-version : 20
27- registry-url : https://npm.pkg.github.com
28- scope : ' @farewellsagittarius'
2926
3027 - name : Install dependencies
3128 run : yarn install --frozen-lockfile --ignore-engines --network-timeout 600000
@@ -36,18 +33,39 @@ jobs:
3633 - name : Build happy-cli
3734 run : yarn workspace happy-coder build
3835
39- - name : Publish to GitHub Packages
36+ - name : Pack tarball
4037 working-directory : packages/happy-cli
38+ run : npm pack --ignore-scripts
39+
40+ - name : Upload to GitHub Release
41+ env :
42+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
4143 run : |
42- # Scope the package and append git sha to version for unique builds
44+ VERSION=$(node -p "require('./packages/happy-cli/ package.json'). version")
4345 SHORT_SHA=$(git rev-parse --short HEAD)
44- node -e "
45- const pkg = require('./package.json');
46- pkg.name = '@farewellsagittarius/happy-coder';
47- pkg.version = pkg.version + '-${SHORT_SHA}';
48- pkg.publishConfig = { registry: 'https://npm.pkg.github.com' };
49- require('fs').writeFileSync('./package.json', JSON.stringify(pkg, null, 2));
50- "
51- npm publish --ignore-scripts || echo "Version already published, skipping"
52- env :
53- NODE_AUTH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
46+ TAG="cli-v${VERSION}-${SHORT_SHA}"
47+ TGZ=$(ls packages/happy-cli/*.tgz)
48+
49+ # Rename to a clean name
50+ cp "$TGZ" packages/happy-cli/happy-coder.tgz
51+
52+ # Delete existing release with same tag if exists
53+ gh release delete "$TAG" --yes 2>/dev/null || true
54+ git tag -d "$TAG" 2>/dev/null || true
55+ git push origin ":refs/tags/$TAG" 2>/dev/null || true
56+
57+ # Create release
58+ gh release create "$TAG" \
59+ packages/happy-cli/happy-coder.tgz \
60+ --title "Happy CLI ${VERSION} (${SHORT_SHA})" \
61+ --notes "Install: \`npm i -g https://github.com/FarewellSagittarius/happy/releases/download/${TAG}/happy-coder.tgz\`"
62+
63+ # Also update the "latest-cli" release for stable URL
64+ gh release delete "latest-cli" --yes 2>/dev/null || true
65+ git tag -d "latest-cli" 2>/dev/null || true
66+ git push origin ":refs/tags/latest-cli" 2>/dev/null || true
67+
68+ gh release create "latest-cli" \
69+ packages/happy-cli/happy-coder.tgz \
70+ --title "Happy CLI Latest" \
71+ --notes "Latest build: ${VERSION} (${SHORT_SHA})"$'\n\n'"Install: \`npm i -g https://github.com/FarewellSagittarius/happy/releases/download/latest-cli/happy-coder.tgz\`"
0 commit comments