fix: skip npm lifecycle scripts when installing production dependenci… #13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release Please | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| id-token: write | |
| jobs: | |
| release-please: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| release_created: ${{ steps.release.outputs.release_created }} | |
| tag_name: ${{ steps.release.outputs.tag_name }} | |
| version: ${{ steps.release.outputs.version }} | |
| steps: | |
| - name: Run Release Please | |
| id: release | |
| uses: googleapis/release-please-action@v4 | |
| with: | |
| release-type: node | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Release Summary | |
| if: steps.release.outputs.release_created | |
| run: | | |
| { | |
| echo "## 🎉 Release Created!" | |
| echo "" | |
| echo "- **Version:** ${{ steps.release.outputs.version }}" | |
| echo "- **Tag:** ${{ steps.release.outputs.tag_name }}" | |
| echo "- **Release URL:** ${{ steps.release.outputs.html_url }}" | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| publish-npm: | |
| needs: release-please | |
| if: needs.release-please.outputs.release_created | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Create package-lock.json if missing | |
| run: | | |
| if [ ! -f package-lock.json ]; then | |
| echo "package-lock.json not found, running npm install to create it" | |
| npm install --package-lock-only --ignore-scripts | |
| fi | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| registry-url: 'https://registry.npmjs.org' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run tests | |
| run: npm test | |
| - name: Build package | |
| run: npm run build | |
| - name: Validate package with publint | |
| run: npx publint --strict | |
| - name: Publish to NPM with provenance | |
| run: npm publish --provenance --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Create tarball | |
| run: npm pack | |
| - name: Upload tarball to GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ needs.release-please.outputs.tag_name }} | |
| files: | | |
| *.tgz | |
| - name: Generate SLSA provenance | |
| uses: slsa-framework/slsa-github-generator@v2.0.0 | |
| with: | |
| artifact-path: ./dist | |
| provenance-name: provenance.intoto.jsonl | |
| - name: NPM Publish Summary | |
| run: | | |
| { | |
| echo "## 📦 NPM Package Published!" | |
| echo "" | |
| echo "- **Package:** @gander-templates/node-project-starter" | |
| echo "- **Version:** ${{ needs.release-please.outputs.version }}" | |
| echo "- **NPM URL:** https://www.npmjs.com/package/@gander-templates/node-project-starter/v/${{ needs.release-please.outputs.version }}" | |
| echo "- **Provenance:** Enabled ✅" | |
| echo "- **SLSA Attestation:** Generated ✅" | |
| } >> "$GITHUB_STEP_SUMMARY" |