-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (76 loc) · 2.87 KB
/
Copy pathci.yml
File metadata and controls
84 lines (76 loc) · 2.87 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
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- run: bun install --frozen-lockfile
- run: bun run build # build first - dependents resolve oyadotai from dist/
- run: bun run typecheck
- run: bun test
# Every push to main that passes `build` cuts a new patch release of both
# libraries to npm's `latest` tag, then commits the version bump + tag back.
# The bump commit carries [skip ci] and is pushed with GITHUB_TOKEN, so it
# does not re-trigger this workflow (no publish loop).
publish:
needs: build
if: >-
github.event_name == 'push' &&
github.ref == 'refs/heads/main' &&
!contains(github.event.head_commit.message, '[skip ci]')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
- run: bun install --frozen-lockfile
# `npm version` cannot parse the `workspace:` protocol this repo uses, so bump
# the patch version by editing the version field directly.
- name: Bump patch versions
run: node scripts/bump-patch.mjs
- run: bun install # sync bun.lock with the bumped versions
- run: bun run build # rebuild dist/ before publishing
- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
(cd packages/core && npm publish --access public)
(cd packages/server && npm publish --access public)
- name: Commit release + tag
run: |
VERSION=$(node -p "require('./packages/core/package.json').version")
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add packages/core/package.json packages/server/package.json bun.lock
git commit -m "release: v$VERSION [skip ci]"
# Annotated tag pushed explicitly. `git push --follow-tags` silently skips
# lightweight tags, which is why earlier releases left no tags on origin.
git tag -a "v$VERSION" -m "v$VERSION"
git push origin HEAD:main
git push origin "v$VERSION"
- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=$(node -p "require('./packages/core/package.json').version")
gh release create "v$VERSION" \
--title "v$VERSION" \
--generate-notes \
--verify-tag