forked from marktext/marktext
-
Notifications
You must be signed in to change notification settings - Fork 0
177 lines (147 loc) · 5.38 KB
/
release.yml
File metadata and controls
177 lines (147 loc) · 5.38 KB
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
name: Release
on:
push:
branches:
- 'release-v*'
jobs:
unix:
runs-on: ${{ matrix.os }}
continue-on-error: false
timeout-minutes: 45
strategy:
matrix:
os: [macos-11, ubuntu-latest]
env:
DISPLAY: ":99.0"
MARKTEXT_IS_STABLE: 1
MARKTEXT_EXIT_ON_ERROR: 1
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: 16
check-latest: true
cache: yarn
cache-dependency-path: yarn.lock
- name: Install build dependencies
if: runner.os == 'Linux'
# electron-builder | keyboard-layout | keytar | fontmanager | RPM on Ubuntu
run: |
sudo apt-get -y update
sudo apt-get install -y icnsutils graphicsmagick xz-utils libx11-dev libxkbfile-dev gnome-keyring libsecret-1-dev libfontconfig-dev rpm
- name: Cache node_modules
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}-node_modules-cache-v2-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
restore-keys: |
${{ runner.os }}-node_modules-cache-v2-
- name: Cache Electron
uses: actions/cache@v2
with:
path: ${{ env.HOME }}/.cache/electron
key: ${{ runner.os }}-electron-cache-v2-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
- name: Cache Electron-Builder
uses: actions/cache@v2
with:
path: ${{ env.HOME }}/.cache//electron-builder
key: ${{ runner.os }}-electron-builder-cache-v2-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
- name: Install dependencies
run: yarn install --check-files --frozen-lockfile
- name: Strip ripgrep on Linux
if: runner.os == 'Linux'
run: strip node_modules/vscode-ripgrep/bin/rg
- name: Lint
run: |
yarn run lint
yarn run validate-licenses
- name: Run unit and E2E tests
uses: GabrielBB/xvfb-action@v1
with:
run: yarn run test
- name: Build and release
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
yarn run release:linux --publish always
elif [ "$RUNNER_OS" == "macOS" ]; then
yarn run release:mac --publish always
else
echo "$RUNNER_OS not supported"
exit 1
fi
- name: Calculate checksums
if: runner.os == 'Linux'
run: |
sha256sum build/marktext-x64.tar.gz
sha256sum build/marktext-x86_64.AppImage
sha256sum build/marktext-*.deb
sha256sum build/marktext-*.rpm
shell: bash
- name: Calculate checksums
if: runner.os == 'macOS'
run: |
shasum -a 256 build/marktext-arm64-mac.zip
shasum -a 256 build/marktext-x64-mac.zip
shasum -a 256 build/marktext-arm64.dmg
shasum -a 256 build/marktext-x64.dmg
shell: bash
windows:
runs-on: windows-latest
continue-on-error: false
timeout-minutes: 45
env:
MARKTEXT_IS_STABLE: 1
MARKTEXT_EXIT_ON_ERROR: 1
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out Git repository
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: 16
check-latest: true
cache: yarn
cache-dependency-path: yarn.lock
# Workaround: Fix native build failure due to outdated node-gyp version.
- name: Fix node-gyp
run: |
npm install --global node-gyp@latest
npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"}
node-gyp install
shell: pwsh
- name: Cache node_modules
uses: actions/cache@v2
with:
path: ${{ github.workspace }}\node_modules
key: ${{ runner.os }}-node_modules-cache-v2-${{ hashFiles(format('{0}{1}', github.workspace, '\yarn.lock')) }}
restore-keys: |
${{ runner.os }}-node_modules-cache-v2-
- name: Cache Electron
uses: actions/cache@v2
with:
path: ${{ env.LOCALAPPDATA }}\electron\Cache
key: ${{ runner.os }}-electron-cache-v2-${{ hashFiles(format('{0}{1}', github.workspace, '\yarn.lock')) }}
- name: Cache Electron-Builder
uses: actions/cache@v2
with:
path: ${{ env.LOCALAPPDATA }}\electron-builder\cache
key: ${{ runner.os }}-electron-builder-cache-v2-${{ hashFiles(format('{0}{1}', github.workspace, '\yarn.lock')) }}
- name: Install dependencies
run: yarn install --check-files --frozen-lockfile
- name: Lint
run: |
yarn run lint
yarn run validate-licenses
- name: Run unit and E2E tests
run: yarn run test
- name: Build and release
run: yarn run release:win --publish always
- name: Calculate checksums
run: |
get-filehash -Algorithm SHA256 "build\marktext-setup.exe"
get-filehash -Algorithm SHA256 "build\marktext-*-win.zip"
shell: pwsh