Create release and publish package update (#501) #33
This file contains hidden or 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: | |
push: | |
branches: | |
- main | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
permissions: | |
contents: write | |
id-token: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Deno | |
uses: denoland/setup-deno@v1 | |
with: | |
deno-version: v2.x | |
- name: Extract version from deno.json | |
id: get_version | |
run: | | |
VERSION=$(jq -r .version < deno.json) | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
- name: Check if version tag already exists | |
run: | | |
TAG="v${{ steps.get_version.outputs.version }}" | |
if git rev-parse "$TAG" >/dev/null 2>&1; then | |
echo "🚫 Tag $TAG already exists. Aborting." | |
exit 1 | |
fi | |
- name: Check Format | |
run: deno fmt --check | |
- name: Format | |
run: deno fmt | |
- name: Lint | |
run: deno lint | |
- name: Build tests container | |
run: docker compose build tests | |
- name: Run tests | |
run: docker compose run tests | |
- name: Run doc tests | |
run: docker compose run doc_tests | |
- name: Create tag for release | |
run: | | |
TAG="v${{ steps.get_version.outputs.version }}" | |
git config user.name "github-actions" | |
git config user.email "[email protected]" | |
git tag "$TAG" | |
git push origin "$TAG" | |
- name: Create GitHub Release | |
run: | | |
gh release create "v${{ steps.get_version.outputs.version }}" \ | |
--title "v${{ steps.get_version.outputs.version }}" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish package | |
run: deno publish |