-
Notifications
You must be signed in to change notification settings - Fork 98
76 lines (60 loc) · 1.79 KB
/
publish_jsr.yml
File metadata and controls
76 lines (60 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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 "github-actions@users.noreply.github.com"
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