Publish to JSR #11
Workflow file for this run
This file contains 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: Publish to JSR | |
on: | |
release: | |
types: [published] | |
permissions: | |
contents: write | |
id-token: write # The OIDC ID token is used for authentication with JSR. | |
jobs: | |
publish: | |
name: Publish to JSR | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Ensure all branches and tags are fetched | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
version: latest | |
run_install: false | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
cache: pnpm | |
cache-dependency-path: ./pnpm-lock.yaml | |
node-version: lts/* | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install Dependencies | |
run: pnpm install | |
- name: Determine Branch | |
run: | |
echo "BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV | |
- name: Set package version | |
run: | | |
TAG_NAME="${{ github.event.release.tag_name }}" | |
VERSION=${TAG_NAME#v} | |
sed -i "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" "deno.jsonc" | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
export HUSKY_SKIP_HOOKS=1 | |
git add deno.jsonc | |
git commit -m "Bump version to $VERSION" | |
git push origin $BRANCH_NAMEs | |
- name: Publish to JSR | |
run: pnpm dlx jsr publish |