-
Notifications
You must be signed in to change notification settings - Fork 327
152 lines (150 loc) · 6.58 KB
/
release-final.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
140
141
142
143
144
145
146
147
148
149
150
151
152
name: "[Release] Publish packages and apps"
on:
workflow_dispatch:
inputs:
app:
description: "which app to release (libraries are always published, chose NONE to release libs only)"
required: true
type: choice
default: NONE
options:
- NONE
- LLD
- LLM
- ALL
workflow_run:
workflows:
- \[Release\] Prepare for releasing
- \[Release\](Hotfix) Prepare for releasing
types:
- "completed"
jobs:
release:
name: Release
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 }}
- uses: actions/checkout@v4
with:
ref: main
fetch-depth: 2
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: ruby/setup-ruby@v1
with:
ruby-version: 3.3.0
- name: Cache LLM pods
uses: actions/cache@v3
with:
path: |
apps/ledger-live-mobile/ios/Pods
~/Library/Caches/CocoaPods
~/.cocoapods
key: ${{ runner.os }}-pods-${{ hashFiles('apps/ledger-live-mobile/ios/Podfile.lock') }}
- name: install dependencies
run: pnpm i -F "ledger-live" -F "{libs/**}..." -F "@ledgerhq/live-cli"
- name: build libs
run: pnpm run build:libs
- name: publish release
run: pnpm changeset publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }}
- name: check if desktop versions are different
if: ${{ github.event_name == 'workflow_run' }}
id: desktop-changed
run: |
echo "status=$(git diff HEAD HEAD~1 ./apps/ledger-live-desktop/package.json | grep '"version": "' | wc -l)" >> $GITHUB_OUTPUT
- name: check if mobile versions are different
if: ${{ github.event_name == 'workflow_run' }}
id: mobile-changed
run: |
echo "status=$(git diff HEAD HEAD~1 ./apps/ledger-live-mobile/package.json | grep '"version": "' | wc -l)" >> $GITHUB_OUTPUT
- 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: generate desktop changelog
if: ${{ steps.desktop-changed.outputs.status != 0 || github.event_name == 'workflow_dispatch' && contains(fromJson('["LLD", "ALL"]'), inputs.app) }}
uses: LedgerHQ/ledger-live/tools/actions/generate-release-message@develop
id: desktop-changelog
with:
package-path: ${{ github.workspace }}/apps/ledger-live-desktop/package.json
changelog-path: ${{ github.workspace }}/apps/ledger-live-desktop/CHANGELOG.md
output-path: ${{ github.workspace }}
name: desktop-changelog
- name: tag desktop
if: ${{ steps.desktop-changed.outputs.status != 0 || github.event_name == 'workflow_dispatch' && contains(fromJson('["LLD", "ALL"]'), inputs.app) }}
run: |
git tag @ledgerhq/live-desktop@${{ steps.desktop-version.outputs.version }}
- name: generate mobile changelog
if: ${{ steps.mobile-changed.outputs.status != 0 || github.event_name == 'workflow_dispatch' && contains(fromJson('["LLM", "ALL"]'), inputs.app) }}
uses: LedgerHQ/ledger-live/tools/actions/generate-release-message@develop
id: mobile-changelog
with:
package-path: ${{ github.workspace }}/apps/ledger-live-mobile/package.json
changelog-path: ${{ github.workspace }}/apps/ledger-live-mobile/CHANGELOG.md
output-path: ${{ github.workspace }}
name: mobile-changelog
- name: tag mobile
if: ${{ steps.mobile-changed.outputs.status != 0 || github.event_name == 'workflow_dispatch' && contains(fromJson('["LLM", "ALL"]'), inputs.app) }}
run: |
git tag live-mobile@${{ steps.mobile-version.outputs.version }}
- name: push changes
run: |
git push origin main --tags
- name: create desktop github release
if: ${{ steps.desktop-changed.outputs.status != 0 || github.event_name == 'workflow_dispatch' && contains(fromJson('["LLD", "ALL"]'), inputs.app) }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create @ledgerhq/live-desktop@${{ steps.desktop-version.outputs.version }} -F ${{ steps.desktop-changelog.outputs.path }}
- name: create mobile github release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ steps.mobile-changed.outputs.status != 0 || github.event_name == 'workflow_dispatch' && contains(fromJson('["LLM", "ALL"]'), inputs.app) }}
run: |
gh release create live-mobile@${{ steps.mobile-version.outputs.version }} -F ${{ steps.mobile-changelog.outputs.path }}
- uses: actions/github-script@v7
name: trigger release build for desktop
if: ${{ steps.desktop-changed.outputs.status != 0 || github.event_name == 'workflow_dispatch' && contains(fromJson('["LLD", "ALL"]'), inputs.app) }}
with:
github-token: ${{ steps.generate-token.outputs.token }}
script: |
github.rest.actions.createWorkflowDispatch({
owner: "ledgerhq",
repo: "ledger-live-build",
ref: "main",
workflow_id: "release-desktop.yml",
inputs: {
branch: "main"
}
});
- uses: actions/github-script@v7
name: trigger release build for mobile
if: ${{ steps.mobile-changed.outputs.status != 0 || github.event_name == 'workflow_dispatch' && contains(fromJson('["LLM", "ALL"]'), inputs.app) }}
with:
github-token: ${{ steps.generate-token.outputs.token }}
script: |
github.rest.actions.createWorkflowDispatch({
owner: "ledgerhq",
repo: "ledger-live-build",
ref: "main",
workflow_id: "release-mobile.yml",
inputs: {
ref: "main"
}
});