chore: add prettier formatting scripts and fix formatting #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 | |
| on: | |
| push: | |
| branches: [main] | |
| paths: [package.json] | |
| permissions: | |
| contents: write | |
| id-token: write # required for npm provenance | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check for version bump | |
| id: version | |
| run: | | |
| VERSION=$(jq -r .version package.json) | |
| TAG="v$VERSION" | |
| if git rev-parse "$TAG" >/dev/null 2>&1; then | |
| echo "Tag $TAG already exists, skipping release" | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "New version detected: $VERSION" | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "tag=$TAG" >> "$GITHUB_OUTPUT" | |
| fi | |
| - uses: oven-sh/setup-bun@ecf28ddc73e819eb6fa29df6b34ef8921c743461 # v2 | |
| if: steps.version.outputs.changed == 'true' | |
| with: | |
| bun-version-file: package.json | |
| - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 | |
| if: steps.version.outputs.changed == 'true' | |
| with: | |
| node-version: lts/* # Node 24 LTS ships npm >=11.5.1, required for OIDC trusted publishing | |
| - name: Install dependencies | |
| if: steps.version.outputs.changed == 'true' | |
| run: bun install --frozen-lockfile | |
| - name: Run checks | |
| if: steps.version.outputs.changed == 'true' | |
| run: bun run ci | |
| - name: Build binaries | |
| if: steps.version.outputs.changed == 'true' | |
| run: bun run build:binary | |
| - name: Build npm package | |
| if: steps.version.outputs.changed == 'true' | |
| run: bun run build | |
| - name: Generate checksums | |
| if: steps.version.outputs.changed == 'true' | |
| run: cd dist && sha256sum jup-* > checksums.txt | |
| - name: Create tag | |
| if: steps.version.outputs.changed == 'true' | |
| run: | | |
| git tag ${{ steps.version.outputs.tag }} | |
| git push origin ${{ steps.version.outputs.tag }} | |
| - name: Create GitHub Release | |
| if: steps.version.outputs.changed == 'true' | |
| uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2 | |
| with: | |
| tag_name: ${{ steps.version.outputs.tag }} | |
| files: | | |
| dist/jup-* | |
| dist/checksums.txt | |
| generate_release_notes: true | |
| - name: Publish to npm | |
| if: steps.version.outputs.changed == 'true' | |
| run: npm publish --access public --provenance |