-
Notifications
You must be signed in to change notification settings - Fork 8
224 lines (216 loc) · 8.06 KB
/
release.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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
name: CD
on:
workflow_run:
workflows:
- CI
branches: [main, beta]
types:
- completed
schedule:
- cron: 0 1 * * * # every night at 1am on dev
workflow_dispatch:
env:
GIT_AUTHOR_EMAIL: ${{ secrets.SOCIALGROOVYBOT_EMAIL }}
GIT_AUTHOR_NAME: ${{ secrets.SOCIALGROOVYBOT_NAME }}
GIT_COMMITTER_EMAIL: ${{ secrets.SOCIALGROOVYBOT_EMAIL }}
GIT_COMMITTER_NAME: ${{ secrets.SOCIALGROOVYBOT_NAME }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WIN_CSC_LINK: ${{ github.workspace }}/certwin.p12
CSC_LINK: ${{ github.workspace }}/certmac.p12
GITHUB_REF_OVERRIDE: ${{ github.event.workflow_run.conclusion == 'success' && format('refs/heads/{0}', github.event.workflow_run.head_branch) || github.ref }}
jobs:
compile:
name: Compile
runs-on: ubuntu-latest
if: "${{ github.event.workflow_run.conclusion == 'success' }}
|| ${{ github.event_name == 'schedule'}}
|| (${{ github.event_name == 'workflow_dispatch' }} && contains('refs/heads/main,refs/heads/beta,refs/heads/dev', github.ref))"
outputs:
current-version: ${{ steps.compile.outputs.current-version }}
next-version: ${{ steps.compile.outputs.next-version }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ env.GITHUB_REF_OVERRIDE }}
- name: Decode certificates
env:
WIN_CSC_LINK_RAW: ${{ secrets.WIN_CSC_LINK }}
CSC_LINK_RAW: ${{ secrets.CSC_LINK }}
run: |
echo "$WIN_CSC_LINK_RAW" > certwin.txt
base64 --decode certwin.txt > $WIN_CSC_LINK
echo "$CSC_LINK_RAW" > certmac.txt
base64 --decode certmac.txt > $CSC_LINK
- name: Archive certificates
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: certificates
path: |
${{ env.WIN_CSC_LINK }}
${{ env.CSC_LINK }}
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
# >> NO Secrets
- name: Temp NO_SECRETS as .env file
run: |
touch ${{ github.run_id }}_${{ github.sha }}.env
echo "${{ secrets.NO_SECRETS }}" >> ${{ github.run_id }}_${{ github.sha }}.env
- name: Convert dotenv as output
id: nosecrets
uses: falti/dotenv-action@v1
with:
path: ${{ github.run_id }}_${{ github.sha }}.env
log-variables: true
mask-variables: false
- name: Remove temp .env file
run: rm -rf ${{ github.run_id }}_${{ github.sha }}.env
# << NO Secrets
- name: Yarn install
run: yarn --frozen-lockfile --perfer-offline
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.SOCIALGROOVYBOT_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.SOCIALGROOVYBOT_GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
git_push_gpgsign: false
git_tag_gpgsign: true
- id: compile
name: Compile
run: |
export PATH="$(pwd)/.github/bin/:$PATH"
# override because of "env-ci" used by semantic-release
# GITHUB_REF should not be default branch when "workflow_run" event is triggered
export GITHUB_REF=$GITHUB_REF_OVERRIDE
echo "current-version=$(node -e "console.log(require('./package.json').version)")" >> $GITHUB_OUTPUT
yarn semantic-release
echo "next-version=$(node -e "console.log(require('./package.json').version)")" >> $GITHUB_OUTPUT
yarn compile --no-progress
env:
ARCHIFILTRE_RELEASE_MODE: version
TRACKER_MATOMO_ID_SITE: ${{ steps.nosecrets.outputs.tracker_matomo_id_site }}
TRACKER_PROVIDER: ${{ steps.nosecrets.outputs.tracker_provider }}
SENTRY_ORG: ${{ steps.nosecrets.outputs.sentry_org }}
TRACKER_MATOMO_URL: ${{ secrets.TRACKER_MATOMO_URL }}
TRACKER_POSTHOG_API_KEY: ${{ secrets.TRACKER_POSTHOG_API_KEY }}
TRACKER_POSTHOG_URL: ${{ secrets.TRACKER_POSTHOG_URL }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_URL: ${{ secrets.SENTRY_URL }}
ARCHIFILTRE_SITE_URL: ${{ secrets.ARCHIFILTRE_SITE_URL }}
FORCE_TRACKING: false
- name: Archive dist
uses: actions/upload-artifact@v3
with:
name: compile-dist
path: dist/
build:
if: ${{ success() }}
needs: compile
strategy:
matrix:
target:
- linux
- mac
- win
include:
- target: linux
os: ubuntu-latest
- target: mac
os: macos-latest
- target: win
os: windows-latest
name: Build binary for ${{ matrix.target }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
ELECTRON_CACHE: ${{ github.workspace }}/.cache/electron
ELECTRON_BUILDER_CACHE: ${{ github.workspace }}/.cache/electron-builder
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ env.GITHUB_REF_OVERRIDE }}
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Yarn install
run: |
yarn config set network-timeout 300000
yarn --frozen-lockfile --perfer-offline
- name: Replace version in package.json
shell: bash
run: |
yarn global add replace
$(yarn global bin)/replace '"version": "${{ needs.compile.outputs.current-version }}"' '"version": "${{ needs.compile.outputs.next-version }}"' package.json
yarn replaceForChannel
####### Activate only if windows msi build fail with "ICE error"
# - name: Hack msi compilation
# if: contains(matrix.os, 'windows')
# shell: bash
# run: $(yarn global bin)/replace 'lightArgs\.push\(\.\.\.objectFiles\);' 'lightArgs.push("-sval", ...objectFiles);' node_modules/app-builder-lib/out/targets/MsiTarget.js
- name: Download dist
uses: actions/download-artifact@v3
with:
name: compile-dist
path: dist/
- name: Download cetificates
uses: actions/download-artifact@v3
with:
name: certificates
- name: Build bin
run: yarn dist:${{ matrix.target }}
- name: Archive bin
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target }}-bin
path: |
electron/dist/*/archifiltre*.*
electron/dist/*/latest*.yml
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ env.GITHUB_REF_OVERRIDE }}
- name: Download all dist form build jobs
uses: actions/download-artifact@v3
with:
path: bin
- name: Generate hashes
run: >-
find . -regextype posix-extended
-regex ".*/bin/.*/archifiltre.*\.(exe|AppImage|dmg|msi|zip)$"
-type f
-exec bash -c "openssl dgst -sha512 {} > {}.sha512" \;
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Yarn install
run: yarn --frozen-lockfile --perfer-offline
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.SOCIALGROOVYBOT_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.SOCIALGROOVYBOT_GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
git_push_gpgsign: false
git_tag_gpgsign: true
- name: Semantic Release
run: |
export PATH="$(pwd)/.github/bin/:$PATH"
export GITHUB_REF=$GITHUB_REF_OVERRIDE
yarn semantic-release