Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup release workflow #578

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Release

on:
push:
tags:
- 'v*.*.*'

jobs:
release:
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: '1.x'

- name: Read jsr.json
id: read-jsr-json
run: |
VERSION=$(deno eval 'import { readFileSync } from "node:fs"; const json = JSON.parse(readFileSync("jsr.json", { encoding: "utf8" })); console.log(json.version)')
echo "version=$VERSION" >> $GITHUB_OUTPUT

- name: Verify tag
if: github.ref_name != steps.read-jsr-json.outputs.version
run: |
echo "Tag ${github.ref_name} does not match jsr.json version ${{ steps.read-jsr-json.outputs.version }}"
exit 1

- name: Publish to JSR
run: deno publish
env:
DENO_AUTH_TOKENS: ${{ secrets.JSR_TOKEN }}