-
Notifications
You must be signed in to change notification settings - Fork 2
51 lines (44 loc) · 1.3 KB
/
publish-bdl-ts-jsr.yml
File metadata and controls
51 lines (44 loc) · 1.3 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
name: Publish bdl-ts to JSR
on:
push:
tags:
- "bdl-ts@*.*.*"
permissions:
contents: read
id-token: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Apply version from tag
working-directory: bdl-ts
env:
GITHUB_REF_NAME: ${{ github.ref_name }}
run: |
deno run -A - <<'EOF'
const tagName = Deno.env.get("GITHUB_REF_NAME") || "";
const match = tagName.match(/^bdl-ts@(.+)$/);
if (!match) {
throw new Error(`Unexpected tag format: ${tagName}`);
}
const denoJsonPath = "deno.json";
const denoJsonText = await Deno.readTextFile(denoJsonPath);
const denoJson = JSON.parse(denoJsonText);
denoJson.version = match[1];
await Deno.writeTextFile(
denoJsonPath,
`${JSON.stringify(denoJson, null, 2)}\n`,
);
console.log(`Applied version ${match[1]} to ${denoJsonPath}`);
EOF
- name: Publish to JSR
working-directory: bdl-ts
env:
JSR_TOKEN: ${{ secrets.JSR_TOKEN }}
run: deno publish --allow-dirty