Repository navigation
77 lines (63 loc) · 2.1 KB
/
Copy pathrelease.yml
File metadata and controls
77 lines (63 loc) · 2.1 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
77
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
# Required for npm trusted publishing (OIDC)
id-token: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
# Node 24 ships npm 11, which is required for trusted publishing
- uses: actions/setup-node@v4
with:
node-version: 24.x
registry-url: "https://registry.npmjs.org"
- run: pnpm install --frozen-lockfile
- name: Lint
run: pnpm lint
- name: Build
run: pnpm build
- name: Typecheck
run: pnpm typecheck
- name: Install Playwright Chromium
working-directory: packages/effect-query
run: pnpm exec playwright install --with-deps chromium
- name: Test
run: pnpm test
- name: Determine npm tag
id: determine_npm_tag
shell: bash
run: |
TAG="${GITHUB_REF#refs/tags/}"
if [[ "$TAG" =~ -(next|canary|alpha|beta|rc) ]]; then
# Extract pre-release tag (e.g., alpha, beta, rc)
NPM_TAG=${BASH_REMATCH[1]}
else
# Check if the commit is on the main branch
git fetch origin main
if git merge-base --is-ancestor "$GITHUB_SHA" origin/main; then
NPM_TAG="latest"
else
echo "The tagged commit is not on the main branch."
echo "::error ::Releases with the 'latest' npm tag must be on the main branch."
exit 1
fi
fi
echo "npm_tag=$NPM_TAG" >> $GITHUB_OUTPUT
echo "Using npm tag: $NPM_TAG"
# Authenticates via OIDC trusted publishing, no NPM_TOKEN needed
- name: Publish to npm
working-directory: packages/effect-query
run: npm publish --access public --tag ${{ steps.determine_npm_tag.outputs.npm_tag }}
# Only create the GitHub release once the package is actually on npm
- run: npx changelogithub
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}