-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (63 loc) · 1.98 KB
/
testing.yml
File metadata and controls
76 lines (63 loc) · 1.98 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: Build and Test @vsce/testing
on:
push:
branches: [ main ]
paths:
- '**'
- '.github/workflows/testing.yml'
pull_request:
branches: [ main ]
workflow_dispatch: # Allow manual triggering
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: write # Needed for committing fmt changes
id-token: write # Needed for JSR publishing
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Regenerate lockfile if needed
run: |
if ! deno cache --check mod.ts 2>/dev/null; then
echo "Regenerating lockfile due to version mismatch"
rm -f deno.lock
deno cache mod.ts
fi
- name: Type check
run: deno task check
- name: Lint code
run: deno task lint
- name: Format code
run: deno task fmt
- name: Commit formatting changes if any
run: |
if [[ -n "$(git status --porcelain)" ]]; then
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add -A
git commit -m "chore: auto-format code"
fi
- name: Run tests
run: deno task test
- name: Validate JSR package
run: deno task publish-dry
- name: Commit changes if any
run: |
if [[ -n "$(git status --porcelain)" ]]; then
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add -A
VERSION=$(jq -r .version jsr.json)
git commit -m "chore: sync testing → v$VERSION"
git push origin HEAD
else
echo "No changes to commit."
fi
- name: Publish to JSR
if: success() && github.ref == 'refs/heads/main'
run: npx jsr publish