Repository navigation
65 lines (56 loc) · 2.11 KB
/
Copy pathpublish.yml
File metadata and controls
65 lines (56 loc) · 2.11 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
name: The Rite of Ascension aka Publish to JSR
# Version is driven by the git tag, not by `jsr.json` (which stays at the
# `0.0.0` placeholder). Push a `vX.Y.Z` or `X.Y.Z` tag - the workflow extracts
# the version, writes it into `jsr.json`, and publishes to JSR via OIDC
# (tokenless, with provenance).
on:
push:
tags:
- 'v*.*.*'
- '[0-9]*.*.*'
workflow_dispatch:
inputs:
version:
description: 'Version to publish, e.g. 0.5.2'
required: true
type: string
concurrency:
group: publish-jsr
cancel-in-progress: false
jobs:
publish:
name: The Offering aka Publish @trakt/api
runs-on: ubuntu-latest
permissions:
contents: read
# Required for JSR provenance via OIDC.
id-token: write
steps:
- name: The Oracle's Gaze aka Checkout Code
uses: actions/checkout@v5
- name: The Summoning aka Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.14
- name: The Reading of the Sign aka Resolve Version
id: version
run: |
RAW="${{ github.event.inputs.version || github.ref_name }}"
VERSION="${RAW#v}"
if ! printf '%s' "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$'; then
echo "::error::Invalid version '$VERSION' (from '$RAW'). Expected x.y.z or vx.y.z."
exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: The Inscription aka Set Version
run: |
sed -i -E "s/\"version\": \"[^\"]*\"/\"version\": \"${{ steps.version.outputs.version }}\"/" projects/api/jsr.json
grep '"version"' projects/api/jsr.json
- name: The Sacred Assembly aka Install Dependencies
run: bun install --frozen-lockfile
- name: The Transcription aka Generate Static Types
run: cd projects/api && bun run build:types
# `--allow-dirty`: the version was injected into jsr.json above, so the
# working tree intentionally differs from the tagged commit.
- name: The Offering aka Publish
run: cd projects/api && bun x jsr publish --allow-dirty