-
Notifications
You must be signed in to change notification settings - Fork 327
106 lines (92 loc) · 3.26 KB
/
release-prepare-hotfix.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: "[Release](Hotfix) Prepare for releasing"
on:
workflow_dispatch:
inputs:
ref:
description: the branch to release from
default: hotfix-TEST-ANGUSBAYLEY
required: true
tag_version:
description: version to hotfix (e.g. 2.91.0)
default: latest
required: false
application:
description: application (LLM | LLD)
required: true
type: choice
options:
- LLM
- LLD
jobs:
prepare-release:
name: Prepare Hotfix
runs-on: ubuntu-24.04
env:
NODE_OPTIONS: "--max-old-space-size=7168"
steps:
- name: generate token
id: generate-token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.GH_BOT_APP_ID }}
private_key: ${{ secrets.GH_BOT_PRIVATE_KEY }}
- name: Checkout Repo (hotfix branch)
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
token: ${{ steps.generate-token.outputs.token }}
- name: Generate ref/tag version to use during main checkout
id: format-app-tag
run: |
if [ ${{ github.event.inputs.tag_version }} = 'latest' ]; then
main_ref="main"
else
if [ "${{ github.event.inputs.application }}" = "LLM" ]; then
formatted_app="live-mobile"
elif [ "${{ github.event.inputs.application }}" = "LLD" ]; then
formatted_app="@ledgerhq/live-desktop"
else
echo "Unknown application"
exit 1
fi
main_ref="${formatted_app}@${{ github.event.inputs.tag_version }}"
fi
echo "main_ref=$main_ref" >> $GITHUB_ENV
echo "Formatted application and tag version: $main_ref"
- name: Checkout repo (main branch)
uses: actions/checkout@v4
with:
ref: ${{ env.main_ref }}
token: ${{ steps.generate-token.outputs.token }}
- name: Setup git user
uses: ./tools/actions/composites/setup-git-user
- name: Setup the toolchain
uses: ./tools/actions/composites/setup-toolchain
- name: install dependencies
run: pnpm i -F "ledger-live"
- name: Generate changeset status
run: pnpm changeset status --output=changeset-status.json
- name: Enforce use of patch level changesets only for hotfixes
run: |
MINOR_MAJOR_CHANGESET_IDS=$(jq -r '.changesets[] | select(.releases[].type == "minor" or .releases[].type == "major") | .id' changeset-status.json)
if [ -n "$MINOR_MAJOR_CHANGESET_IDS" ]; then
echo "Major/minor changesets found:"
echo "$MINOR_MAJOR_CHANGESET_IDS"
echo "❌ Hotfixes must use patch level changesets only"
exit 1
else
echo "✅ No major/minor level changesets found."
fi
- name: exit prerelease mode
run: pnpm changeset pre exit
- name: versioning
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: pnpm changeset version
- name: commit
run: |
git add .
git commit -m "chore(hotfix): :fire: hotfix release [skip ci]"
- name: push changes
run: |
git push origin ${{ inputs.ref }}