Repository navigation
72 lines (60 loc) · 1.99 KB
/
Copy pathrelease.yml
File metadata and controls
72 lines (60 loc) · 1.99 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
name: Release Client TypeScript
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
dry_run:
description: "Dry run (build only, no publish)"
type: boolean
default: false
permissions:
id-token: write # Required for OIDC
contents: read
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 10.26.2
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "latest"
registry-url: "https://registry.npmjs.org"
cache: "pnpm"
- name: Upgrade npm
run: npm install -g npm@latest
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Lint
run: pnpm lint
- name: Build
run: pnpm build
# Determine npm dist-tag from version string
# e.g. 0.2.0-alpha.1 → "next", 0.2.0 → "latest"
- name: Determine dist-tag
id: dist-tag
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION"
if echo "$VERSION" | grep -qE '-(alpha|beta|rc|dev|canary)'; then
echo "tag=next" >> "$GITHUB_OUTPUT"
else
echo "tag=latest" >> "$GITHUB_OUTPUT"
fi
- name: Publish to npm
if: ${{ github.event.inputs.dry_run != 'true' }}
run: |
echo "Publishing v$(node -p "require('./package.json').version") with tag: ${{ steps.dist-tag.outputs.tag }}"
pnpm publish --access public --no-git-checks --provenance --tag ${{ steps.dist-tag.outputs.tag }}
- name: Dry run summary
if: ${{ github.event.inputs.dry_run == 'true' }}
run: |
echo "Dry run — build succeeded, skipping publish"
echo "Would publish v$(node -p "require('./package.json').version") with tag: ${{ steps.dist-tag.outputs.tag }}"