Skip to content

javascript: v0.5.0

javascript: v0.5.0 #62

name: javascript-publish
on:
release:
types: [published]
workflow_dispatch:
permissions:
id-token: write
contents: read
jobs:
publish:
if: |
(github.event_name == 'release' && startsWith(github.event.release.tag_name, 'javascript/')) ||
(github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Setup pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4
with:
version: 10.12.1
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
cache-dependency-path: "javascript/pnpm-lock.yaml"
node-version: "24.x"
cache: "pnpm"
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
working-directory: javascript
run: pnpm install --frozen-lockfile
- name: Run tests
working-directory: javascript
run: pnpm test:ci
- name: Extract version from tag
id: version
run: |
TAG_NAME="${GITHUB_REF#refs/tags/}"
VERSION="${TAG_NAME#javascript/v}"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Determine dist-tag
id: disttag
run: |
VERSION="${{ steps.version.outputs.version }}"
if [[ "$VERSION" == *"-"* ]]; then
echo "tag=prerelease" >> "$GITHUB_OUTPUT"
else
echo "tag=latest" >> "$GITHUB_OUTPUT"
fi
- name: Publish to npm
working-directory: javascript
run: pnpm publish --provenance --access public --no-git-checks --tag ${{ steps.disttag.outputs.tag }}