diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dc7cbb5..dba699b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,8 @@ jobs: release: runs-on: ubuntu-latest permissions: - contents: read + contents: write + id-token: write steps: - uses: actions/checkout@v4 @@ -27,7 +28,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: 22 + node-version: 24 registry-url: https://registry.npmjs.org - name: Install Dependencies @@ -49,8 +50,28 @@ jobs: fi echo "Version OK: $cli_version" + - name: Verify Tag Matches package.json + if: startsWith(github.ref, 'refs/tags/v') + run: | + tag_version="${GITHUB_REF_NAME#v}" + pkg_version="$(node -p "require('./package.json').version")" + if [ "$tag_version" != "$pkg_version" ]; then + echo "Tag/package mismatch: tag=$tag_version package=$pkg_version" + exit 1 + fi + echo "Tag matches package version: $pkg_version" + + - name: Pack npm artifact + run: npm pack --pack-destination . + + - name: Create GitHub Release + if: startsWith(github.ref, 'refs/tags/v') + uses: softprops/action-gh-release@v2 + with: + generate_release_notes: true + files: | + *.tgz + - name: Publish To npm if: ${{ github.event_name == 'push' || github.event.inputs.publish == 'true' }} run: npm publish --cache /tmp/npm-cache - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index cb038e5..96d5236 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,10 @@ "name": "bluebubbles-cli", "version": "0.1.6", "description": "Curated BlueBubbles CLI organized around terminal-friendly resources", + "repository": { + "type": "git", + "url": "https://github.com/anmho/bluebubbles-cli" + }, "type": "module", "bin": { "bluebubbles": "dist/index.js"