Skip to content

Commit

Permalink
Release workflow for JSR
Browse files Browse the repository at this point in the history
  • Loading branch information
CatChen committed Nov 24, 2024
1 parent 02f85c2 commit ebc8740
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 1 deletion.
45 changes: 45 additions & 0 deletions .github/workflows/jsr-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: JSR Package

on:
release:
types: [created]
workflow_call:
inputs:
tag:
type: string
required: false
dry-run:
type: boolean
default: false
required: false
workflow_dispatch:

permissions:
contents: read
id-token: write

jobs:
publish-jsr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
if: ${{ !inputs.dry-run }}
with:
ref: ${{ inputs.tag }}
- uses: actions/checkout@v4
if: ${{ inputs.dry-run }}
with:
ref: ${{ github.ref_name || github.ref }}
- uses: denoland/setup-deno@v2
with:
deno-version: latest
- env:
DRY_RUN: ${{ inputs.dry-run || false }}
run: |
deno install
if [[ "$DRY_RUN" = true ]]
then
deno publish --dry-run
else
deno publish
fi
23 changes: 22 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,14 @@ jobs:
node:
uses: ./.github/workflows/node.yml

deno:
uses: ./.github/workflows/deno.yml

codeql:
uses: ./.github/workflows/codeql-analysis.yml

release:
needs: [node, codeql]
needs: [node, deno, codeql]
concurrency: release
runs-on: ubuntu-latest
outputs:
Expand All @@ -59,6 +62,16 @@ jobs:
ref: main
fetch-depth: 0

- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
check-latest: true
cache: yarn

- run: |
yarn install
yarn husky # Set up pre-commit hook so npm version commit will copy the version to jsr.json
- id: release
uses: CatChen/node-package-release-action@v2
with:
Expand All @@ -76,3 +89,11 @@ jobs:
with:
tag: ${{ needs.release.outputs.tag }}
dry-run: ${{ inputs.dry-run || false }}

jsr-publish:
needs: release
if: ${{ needs.release.outputs.skipped != 'true' }}
uses: ./.github/workflows/jsr-publish.yml
with:
tag: ${{ needs.release.outputs.tag }}
dry-run: ${{ inputs.dry-run || false }}

0 comments on commit ebc8740

Please sign in to comment.