-
Notifications
You must be signed in to change notification settings - Fork 68
207 lines (170 loc) · 6.37 KB
/
main.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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
name: Build Main
on:
push:
tags:
- 'v*'
workflow_dispatch:
env:
owner: ObsidianLabs
own_components: bsc-components
share_components: electron-components
eth_components: eth-components
project_build: eth
project_project: bsc
project_name: BNB Studio
project_build_script: yarn && yarn dist
os_matrix: '[\"macos-latest\", \"ubuntu-18.04\", \"windows-2019\"]'
enable_auth: false
premium_editor: ../premium-editor
GH_TOKEN: ${{ secrets.obsidians_token }}
jobs:
# Generate matrix for the following steps
generate-matrix:
runs-on: ubuntu-18.04
steps:
- name: Generate os matrix
id: set-os-matrix
run: echo ::set-output name=os::${{ env.os_matrix }}
- name: Generate component matrix
id: set-component-matrix
run: echo ::set-output name=component::[\"${{ env.own_components }}\", \"${{ env.share_components }}\"]
outputs:
os: ${{ steps.set-os-matrix.outputs.os }}
component: ${{ steps.set-component-matrix.outputs.component }}
# Extract version
versions:
runs-on: ubuntu-18.04
steps:
- name: Get ${{ env.project_name }} version
id: version
shell: bash
run: echo ::set-output name=VERSION::${GITHUB_REF##*[\/v]}
outputs:
version: ${{ steps.version.outputs.VERSION }}
v_version: v${{ steps.version.outputs.VERSION }}
component_version: v${{ steps.version.outputs.VERSION }}-${{ env.project_build }}
new_release: ${{ steps.version.outputs.VERSION != 'master' && steps.version.outputs.VERSION != 'develop' }}
# Update package.json version to match release version
bump:
needs: versions
runs-on: ubuntu-18.04
steps:
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v1
with:
node-version: 16
- name: Checkout code
uses: actions/checkout@v2
with:
ref: master
fetch-depth: 0
- name: Bump version
if: ${{ needs.versions.outputs.new_release == 'true' }}
run: |
yarn config set version-git-tag false
yarn version --new-version ${{ needs.versions.outputs.version }}
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git diff-index --quiet HEAD || git commit -am '${{ needs.versions.outputs.v_version }}'
- name: Push changes
if: ${{ needs.versions.outputs.new_release == 'true' }}
run: |
git checkout develop
git merge master
git push origin master:master
git push origin develop:develop
# Build and release
release:
needs: [ generate-matrix, versions, bump ]
strategy:
matrix:
os: ${{ fromJson(needs.generate-matrix.outputs.os) }}
runs-on: ${{ matrix.os }}
steps:
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v1
with:
node-version: 16
- name: Checkout ${{ env.share_components }}
uses: actions/checkout@v2
with:
repository: ${{ env.owner }}/${{ env.share_components }}
ref: master
path: ./${{ env.share_components }}
token: ${{ secrets.obsidians_token }}
- name: Checkout ${{ env.eth_components }}
uses: actions/checkout@v2
with:
repository: ${{ env.owner }}/${{ env.eth_components }}
ref: master
path: ./${{ env.eth_components }}
token: ${{ secrets.obsidians_token }}
- name: Checkout ${{ env.own_components }}
uses: actions/checkout@v2
with:
repository: ${{ env.owner }}/${{ env.own_components }}
ref: master
path: ./${{ env.own_components }}
token: ${{ secrets.obsidians_token }}
- name: Checkout Premium Editor
uses: actions/checkout@v2
with:
repository: ${{ env.owner }}/premium-editor
ref: develop
path: ./premium-editor
token: ${{ secrets.obsidians_token }}
- name: Checkout ${{ env.project_name }}
uses: actions/checkout@v2
with:
ref: master
path: ./studio
- name: Install ${{ env.share_components }} submodule
working-directory: ./${{ env.share_components }}
run: git submodule update --init
- name: Install ${{ env.share_components }} dependencies
working-directory: ./${{ env.share_components }}
run: yarn
- name: Build ${{ env.share_components }}
working-directory: ./${{ env.share_components }}
run: yarn build
- name: Install ${{ env.eth_components }} submodule
working-directory: ./${{ env.eth_components }}
run: git submodule update --init
- name: Install ${{ env.eth_components }} dependencies
working-directory: ./${{ env.eth_components }}
run: yarn
- name: Build ${{ env.eth_components }}
working-directory: ./${{ env.eth_components }}
run: yarn build
- name: Install ${{ env.own_components }} submodule
working-directory: ./${{ env.own_components }}
run: git submodule update --init
- name: Install ${{ env.own_components }} dependencies
working-directory: ./${{ env.own_components }}
run: yarn
- name: Build ${{ env.own_components }}
working-directory: ./${{ env.own_components }}
run: yarn build
- name: Install Premium Editor dependencies
working-directory: ./premium-editor
run: yarn
- name: Build Premium Editor
working-directory: ./premium-editor
run: yarn build
- name: Build ${{ env.project_name }}
uses: ObsidianLabs/studio-build-action@master
with:
build: ${{ env.project_build }}
project: ${{ env.project_project }}
project_name: ${{ env.project_name }}
build_script: ${{ env.project_build_script }}
working-directory: ./studio
enable_auth: ${{ env.enable_auth }}
fontawesome_token: ${{ secrets.fontawesome_token }}
mac_certs: ${{ secrets.certs }}
mac_certs_password: ${{ secrets.certs_password }}
windows_certs: ${{ secrets.certs }}
windows_certs_password: ${{ secrets.certs_password }}
react_app_mixpanel_token: ${{ secrets.react_app_mixpanel_token }}
premium_editor: ${{ env.premium_editor }}
github_token: ${{ github.token }}