-
Notifications
You must be signed in to change notification settings - Fork 332
139 lines (137 loc) · 5.57 KB
/
release-prerelease.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: "[Release](Prerelease) Publish packages and apps"
on:
push:
branches:
- release
- hotfix
workflow_dispatch:
inputs:
ref:
description: the branch to prerelease from
required: true
jobs:
prerelease:
name: Prerelease
runs-on: ubuntu-latest
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 }}
- uses: actions/checkout@v4
if: ${{ github.event_name == 'push' }}
with:
token: ${{ steps.generate-token.outputs.token }}
- uses: actions/checkout@v4
if: ${{ github.event_name == 'workflow_dispatch' }}
with:
ref: ${{ inputs.ref }}
token: ${{ steps.generate-token.outputs.token }}
- name: Setup git user
uses: LedgerHQ/ledger-live/tools/actions/composites/setup-git-user@develop
- name: Setup the toolchain
uses: LedgerHQ/ledger-live/tools/actions/composites/setup-toolchain@develop
- uses: LedgerHQ/ledger-live/tools/actions/get-package-infos@develop
id: desktop-version
with:
path: ${{ github.workspace }}/apps/ledger-live-desktop
- uses: LedgerHQ/ledger-live/tools/actions/get-package-infos@develop
id: mobile-version
with:
path: ${{ github.workspace }}/apps/ledger-live-mobile
- name: install dependencies
run: pnpm i -F "ledger-live" -F "{libs/**}..." -F "@ledgerhq/live-cli"
- name: build libs
run: pnpm run build:libs
- name: versioning
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: pnpm changeset version
- uses: LedgerHQ/ledger-live/tools/actions/get-package-infos@develop
id: post-desktop-version
with:
path: ${{ github.workspace }}/apps/ledger-live-desktop
- uses: LedgerHQ/ledger-live/tools/actions/get-package-infos@develop
id: post-mobile-version
with:
path: ${{ github.workspace }}/apps/ledger-live-mobile
- name: commit (from release branch)
if: ${{ startsWith(github.ref_name, 'release') }}
env:
LLD: LLD(${{ steps.post-desktop-version.outputs.version }})
LLM: LLM(${{ steps.post-mobile-version.outputs.version }})
run: |
git add . &&
git commit -m "chore(prerelease): :rocket: release prerelease [${{ env.LLD }}, ${{ env.LLM }}]" ||
echo ""
- name: commit (from hotfix branch)
if: ${{ startsWith(github.ref_name, 'hotfix') }}
env:
LLD: LLD(${{ steps.post-desktop-version.outputs.version }})
LLM: LLM(${{ steps.post-mobile-version.outputs.version }})
run: |
git add . &&
git commit -m "chore(hotfix): :fire: hotfix prerelease [${{ env.LLD }}, ${{ env.LLM }}]" ||
echo ""
- name: commit (from ${{ inputs.ref }} branch) workflow dispatch
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
git add .
git commit -m "chore(prerelease): :rocket: ${{ inputs.ref }} prerelease [LLD(${{ steps.post-desktop-version.outputs.version }}), LLM(${{ steps.post-mobile-version.outputs.version }})]" ||
echo ""
- name: publish prerelease
run: pnpm changeset publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }}
- name: tag desktop
if: ${{ steps.desktop-version.outputs.version != steps.post-desktop-version.outputs.version }}
run: |
git tag @ledgerhq/live-desktop@${{ steps.post-desktop-version.outputs.version }}
- name: tag mobile
if: ${{ steps.mobile-version.outputs.version != steps.post-mobile-version.outputs.version }}
run: |
git tag live-mobile@${{ steps.post-mobile-version.outputs.version }}
- name: push changes (push event)
if: ${{ github.event_name == 'push' }}
run: |
git pull --rebase
git push origin ${{ github.ref_name }} --follow-tags
- name: push changes (other events)
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
git pull --rebase
git push origin ${{ inputs.ref }} --follow-tags
- uses: actions/github-script@v6
name: trigger prerelease build for desktop
if: ${{ steps.desktop-version.outputs.version != steps.post-desktop-version.outputs.version }}
with:
github-token: ${{ steps.generate-token.outputs.token }}
script: |
github.rest.actions.createWorkflowDispatch({
owner: "ledgerhq",
repo: "ledger-live-build",
ref: "main",
workflow_id: "pre-desktop.yml",
inputs: {
ref: "${{ github.event_name == 'workflow_dispatch' && inputs.ref || github.ref_name }}",
}
});
- uses: actions/github-script@v6
name: trigger prerelease build of mobile
if: ${{ steps.mobile-version.outputs.version != steps.post-mobile-version.outputs.version }}
with:
github-token: ${{ steps.generate-token.outputs.token }}
script: |
github.rest.actions.createWorkflowDispatch({
owner: "ledgerhq",
repo: "ledger-live-build",
ref: "main",
workflow_id: "pre-mobile.yml",
inputs: {
ref: "${{ github.event_name == 'workflow_dispatch' && inputs.ref || github.ref_name }}",
}
});