-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
92 lines (89 loc) · 3.59 KB
/
release_publish-beta.yml
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
name: 0. Release > Beta
on:
workflow_dispatch:
inputs:
# This input is used to determine whether to start/continue a beta-cycle vs mirror from canary.
#
# A beta-cycle "forks" from canary. It starts by updating the beta branch to the current state
# of main (canary). Thereafter any updates to the beta branch are cherry-picked from main or PR'd
# to the beta branch.
#
# The (default) mirror approach instead directly copies the canary release to the beta branch
# each time. This is useful when the changes in canary are relatively minor or safe to release
# and
# and then publishing a beta release. A mirror is a direct copy of the canary release.
kind:
description: 'Whether to start/continue a beta-cycle vs mirror from canary'
required: true
default: 'mirror'
type: choice
options:
- beta-cycle # start or continue a beta-cycle.
- mirror # mirror code from canary. This is the default.
# At cycle start we must always reset the beta branch to main.
is-cycle-start:
description: 'Whether this is the start of a new release cycle (either kind)'
required: true
default: false
type: boolean
env:
TURBO_API: http://127.0.0.1:9080
TURBO_TOKEN: this-is-not-a-secret
TURBO_TEAM: myself
jobs:
release:
name: Run publish script
runs-on: ubuntu-latest
environment: deployment
steps:
- name: Enforce Branch
# Note: we always checkout beta in actions/checkout, but this enforces
# good hygiene.
if: github.ref != 'refs/heads/main'
run: |
echo "Releases may only be performed from the main branch."
exit 1
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
with:
fetch-tags: true
show-progress: false
token: ${{ secrets.GH_DEPLOY_TOKEN }}
fetch-depth: 3
ref: beta
- run: git fetch origin main --depth=1
- run: git fetch origin --tags --depth=1
- name: Make sure git user is setup
run: |
git config --local user.email ${{ secrets.GH_DEPLOY_EMAIL }}
git config --local user.name ${{ secrets.GH_DEPLOY_NAME }}
- name: Reset the Beta Branch
if: github.event.inputs.kind == 'mirror' || github.event.inputs.is-cycle-start == 'true'
run: git reset --hard origin/main && git push origin beta -f
- uses: ./.github/actions/setup
with:
install: true
repo-token: ${{ secrets.GH_DEPLOY_TOKEN }}
- name: Get most recent beta version
id: version
if: github.event.inputs.kind == 'mirror'
run: echo "value=$(bun --silent release latest beta)" >> $GITHUB_OUTPUT
- name: Publish New Release
# For beta-cycle we always increment from the branch state
# For mirror we increment from the last beta version, unless it's start of a new cycle.
if: github.event.inputs.kind == 'beta-cycle' || github.event.inputs.is-cycle-start == 'true'
run: bun release exec publish beta
env:
FORCE_COLOR: 2
CI: true
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
- name: Publish New Mirror Release
if: github.event.inputs.kind == 'mirror'
run: bun release exec publish beta --from=${{ steps.version.outputs.value }}
env:
FORCE_COLOR: 2
CI: true
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
- uses: actions/upload-artifact@v4
with:
name: tarballs
path: tmp/tarballs/**/*.tgz