-
-
Notifications
You must be signed in to change notification settings - Fork 94
78 lines (63 loc) · 2.26 KB
/
release-canary.yaml
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
name: Release - Canary
on:
pull_request:
types: [labeled]
branches:
- main
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
jobs:
release:
if: contains(github.event.pull_request.labels.*.name, 'release canary')
name: Build & Publish a canary release
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- uses: ./.github/setup
- name: Build
run: bun run build
- name: Bump version to canary
run: node .github/canary-version.js
- name: Authenticate to npm and publish
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
for dir in packages/*/; do
npm publish "$dir" --access public --tag canary
done
- name: Create a new comment notifying of the new canary version
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
// Get package version
const fs = require("fs");
const packageJson = JSON.parse(fs.readFileSync("./packages/core/package.json"));
const version = packageJson.version;
// Create a comment on the PR with the new canary version
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: `A new canary is available for testing. You can install this latest build in your project with:
\`\`\`sh
pnpm add @t3-oss/env-core@${version}
\`\`\`
or, if you're using Next.js:
\`\`\`sh
pnpm add @t3-oss/env-nextjs@${version}
\`\`\`
or, if you're using Nuxt:
\`\`\`sh
pnpm add @t3-oss/env-nuxt@${version}
\`\`\`
`,
})
// Remove the label
github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
name: 'release canary',
});