Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ jobs:
with:
name: dist
path: dist
if-no-files-found: error
retention-days: 7

codeql:
name: analyze (${{ matrix.language }})
Expand Down
86 changes: 86 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: release

permissions: {}

on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: "Tag to release (e.g. v1.3.0)"
required: true
type: string
prerelease:
description: "Mark as prerelease"
type: boolean
default: false
required: true
draft:
description: "Create as draft"
type: boolean
default: false
required: true

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
persist-credentials: true

- if: github.event_name == 'workflow_dispatch'
run: |
tag="${{ inputs.tag }}"
if git rev-parse -q --verify "refs/tags/$tag" >/dev/null; then
echo "Tag $tag exists"
else
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "$tag" -m "Release $tag"
git push origin "$tag"
fi

- uses: pnpm/action-setup@v4
with:
version: latest
run_install: false

- uses: actions/setup-node@v6
with:
node-version-file: ".nvmrc"
cache: "pnpm"

- run: pnpm install --frozen-lockfile
- run: pnpm run fmt:check
- run: pnpm run lint:check
- run: pnpm run build

- run: |
tar -czf dist.tar.gz -C dist .
sha256sum dist.tar.gz | tee dist.tar.gz.sha256

- id: meta
run: |
if [ "${{ github.event_name }}" = "push" ]; then
echo "tag=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
else
echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
fi

- uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.meta.outputs.tag }}
name: ${{ steps.meta.outputs.tag }}
draft: ${{ github.event_name == 'workflow_dispatch' && inputs.draft || false }}
prerelease: ${{ github.event_name == 'workflow_dispatch' && inputs.prerelease || false }}
files: |
dist.tar.gz
dist.tar.gz.sha256
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}