-
Notifications
You must be signed in to change notification settings - Fork 111
100 lines (89 loc) · 3.01 KB
/
release.yml
File metadata and controls
100 lines (89 loc) · 3.01 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Release
on:
workflow_dispatch:
inputs:
version:
description: "Version to publish (e.g. 0.1.0, 0.1.0-rc.1)"
required: true
type: string
npm-tag:
description: "npm dist-tag"
required: true
type: choice
options:
- latest
- rc
concurrency:
group: release
cancel-in-progress: false
jobs:
publish:
name: "Publish"
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout tag
uses: actions/checkout@v4
with:
ref: v${{ inputs.version }}
- name: Set up pnpm
uses: pnpm/action-setup@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
- name: Build
run: npx turbo build --filter='!./registry/software/*' --filter='!@rivet-dev/agent-os-playground' --filter='!./examples/*'
- name: Publish to npm
run: |
FAILURES=""
# Publish workspace packages (skip root, skip registry/software/)
for dir in $(pnpm -r ls --json --depth -1 | jq -r '.[] | select(.private != true) | .path'); do
# Skip the root package
if [ "$dir" = "$(pwd)" ]; then
continue
fi
# Skip registry/software/ packages (published separately via make publish)
if [[ "$dir" == *"/registry/software/"* ]]; then
echo "⏭ Skipping software package: $(jq -r .name "$dir/package.json")"
continue
fi
NAME=$(jq -r .name "$dir/package.json")
VERSION="${{ inputs.version }}"
if npm view "${NAME}@${VERSION}" version >/dev/null 2>&1; then
echo "⏭ ${NAME}@${VERSION} already published, skipping."
continue
fi
echo "Publishing ${NAME}@${VERSION}..."
if ! (cd "$dir" && pnpm publish --access public --tag ${{ inputs.npm-tag }} --no-git-checks); then
FAILURES="${FAILURES} ${NAME}"
fi
done
if [ -n "$FAILURES" ]; then
echo "::error::Failed to publish:${FAILURES}"
exit 1
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create GitHub release
run: |
if gh release view "v${{ inputs.version }}" >/dev/null 2>&1; then
echo "GitHub release v${{ inputs.version }} already exists, skipping."
else
PRERELEASE=""
if [ "${{ inputs.npm-tag }}" = "rc" ]; then
PRERELEASE="--prerelease"
fi
gh release create "v${{ inputs.version }}" \
--title "v${{ inputs.version }}" \
--generate-notes \
$PRERELEASE
fi
env:
GH_TOKEN: ${{ github.token }}