4
# https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#example-including-branches-and-tags
6
# Sequence of patterns matched against refs/heads
9
# Sequence of patterns matched against refs/tags
13
branches: [ "master" ]
17
name: Build Linux packages
18
runs-on: ubuntu-latest
23
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26
uses: actions/checkout@v3
27
- name: Setup Node.js ${{ matrix.node-version }}
28
uses: actions/setup-node@v3
30
node-version: ${{ matrix.node-version }}
31
- name: Environment variables
33
# https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
34
echo "• GITHUB_REF_NAME=$GITHUB_REF_NAME"
35
echo "• GITHUB_REF_TYPE=$GITHUB_REF_TYPE" # `branch` or `tag`
36
echo "• GITHUB_RUN_NUMBER=$GITHUB_RUN_NUMBER"
37
echo "• GITHUB_SHA=$GITHUB_SHA"
38
echo "• RUNNER_ARCH=$RUNNER_ARCH"
39
echo "• RUNNER_NAME=$RUNNER_NAME"
40
echo "• RUNNER_OS=$RUNNER_OS"
41
echo "• RUNNER_TEMP=$RUNNER_TEMP"
42
echo "• RUNNER_TOOL_CACHE=$RUNNER_TOOL_CACHE"
43
- name: Install Yarn package manager
44
run: npm install -g yarn
45
- name: Install necessary dependencies and perform initial checks
51
- name: Run "build" script
52
if: github.ref_type == 'tag'
54
- name: Run "build-latest" script
55
if: github.ref_type == 'branch'
56
run: yarn run build-latest
57
- name: Build Linux binaries
60
- name: Prepare release assets
63
GIT_COMMIT_LOG=`git log -1 --format='%ci %H %s'`
65
PACKAGE_NAME=`node -e "console.log(require('./src/package.json').name)"`
66
PACKAGE_VERSION=`node -e "console.log(require('./src/package.json').version)"`
67
mkdir -p releases/linux
68
cp -af "output/${PACKAGE_NAME}-${PACKAGE_VERSION}.x86_64.rpm" "releases/linux/${PACKAGE_NAME}-${PACKAGE_VERSION}-linux.x86_64.rpm"
69
cp -af "output/${PRODUCT_NAME}-${PACKAGE_VERSION}.AppImage" "releases/linux/${PACKAGE_NAME}-${PACKAGE_VERSION}-linux-x86_64.AppImage"
70
cp -af "output/${PACKAGE_NAME}_${PACKAGE_VERSION}_amd64.deb" "releases/linux/${PACKAGE_NAME}-${PACKAGE_VERSION}-linux-amd64.deb"
71
cp -af "output/${PACKAGE_NAME}-${PACKAGE_VERSION}.armv7l.rpm" "releases/linux/${PACKAGE_NAME}-${PACKAGE_VERSION}-linux.armv7l.rpm"
72
cp -af "output/${PRODUCT_NAME}-${PACKAGE_VERSION}-armv7l.AppImage" "releases/linux/${PACKAGE_NAME}-${PACKAGE_VERSION}-linux-armv7l.AppImage"
73
cp -af "output/${PACKAGE_NAME}_${PACKAGE_VERSION}_armv7l.deb" "releases/linux/${PACKAGE_NAME}-${PACKAGE_VERSION}-linux-armv7l.deb"
74
cp -af "output/${PACKAGE_NAME}-${PACKAGE_VERSION}.aarch64.rpm" "releases/linux/${PACKAGE_NAME}-${PACKAGE_VERSION}-linux.aarch64.rpm"
75
cp -af "output/${PRODUCT_NAME}-${PACKAGE_VERSION}-arm64.AppImage" "releases/linux/${PACKAGE_NAME}-${PACKAGE_VERSION}-linux-arm64.AppImage"
76
cp -af "output/${PACKAGE_NAME}_${PACKAGE_VERSION}_arm64.deb" "releases/linux/${PACKAGE_NAME}-${PACKAGE_VERSION}-linux-arm64.deb"
78
ln -sf ../../output/linux-unpacked "${PACKAGE_NAME}-${PACKAGE_VERSION}-linux-x64"
79
tar zcfh "${PACKAGE_NAME}-${PACKAGE_VERSION}-linux-x64.tar.gz" "${PACKAGE_NAME}-${PACKAGE_VERSION}-linux-x64"
80
rm -f "${PACKAGE_NAME}-${PACKAGE_VERSION}-linux-x64"
81
ln -sf ../../output/linux-armv7l-unpacked "${PACKAGE_NAME}-${PACKAGE_VERSION}-linux-armv7l"
82
tar zcfh "${PACKAGE_NAME}-${PACKAGE_VERSION}-linux-armv7l.tar.gz" "${PACKAGE_NAME}-${PACKAGE_VERSION}-linux-armv7l"
83
rm -f "${PACKAGE_NAME}-${PACKAGE_VERSION}-linux-armv7l"
84
ln -sf ../../output/linux-arm64-unpacked "${PACKAGE_NAME}-${PACKAGE_VERSION}-linux-arm64"
85
tar zcfh "${PACKAGE_NAME}-${PACKAGE_VERSION}-linux-arm64.tar.gz" "${PACKAGE_NAME}-${PACKAGE_VERSION}-linux-arm64"
86
rm -f "${PACKAGE_NAME}-${PACKAGE_VERSION}-linux-arm64"
88
ls -al output releases/linux
89
if [[ "$GITHUB_REF_TYPE" == "branch" && "$GITHUB_REF_NAME" == "master" ]]; then
90
yarn github-release delete \
93
--tag="${GITHUB_REF_NAME}-latest" \
94
--release-name="${GITHUB_REF_NAME}" \
96
yarn github-release upload \
99
--tag="${GITHUB_REF_NAME}-latest" \
100
--release-name="${GITHUB_REF_NAME}" \
101
--body="${GIT_COMMIT_LOG}" \
104
#- name: Upload release assets
105
# uses: actions/github-script@v6
107
# github-token: ${{ secrets.GITHUB_TOKEN }}
109
# // https://github.com/actions/upload-release-asset/issues/47#issuecomment-659071145
110
# console.log('environment:', process.versions);
112
uses: softprops/action-gh-release@v1
113
if: startsWith(github.ref, 'refs/tags/')
119
name: Build macOS packages
120
runs-on: macos-latest
125
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
127
- name: Checkout code
128
uses: actions/checkout@v3
129
- name: Setup Node.js ${{ matrix.node-version }}
130
uses: actions/setup-node@v3
132
node-version: ${{ matrix.node-version }}
133
- name: Environment variables
135
# https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
136
echo "• GITHUB_REF_NAME=$GITHUB_REF_NAME"
137
echo "• GITHUB_REF_TYPE=$GITHUB_REF_TYPE" # `branch` or `tag`
138
echo "• GITHUB_RUN_NUMBER=$GITHUB_RUN_NUMBER"
139
echo "• GITHUB_SHA=$GITHUB_SHA"
140
echo "• RUNNER_ARCH=$RUNNER_ARCH"
141
echo "• RUNNER_NAME=$RUNNER_NAME"
142
echo "• RUNNER_OS=$RUNNER_OS"
143
echo "• RUNNER_TEMP=$RUNNER_TEMP"
144
echo "• RUNNER_TOOL_CACHE=$RUNNER_TOOL_CACHE"
145
- name: Install Yarn package manager
146
run: npm install -g yarn
147
- name: Install necessary dependencies and perform initial checks
153
- name: Run "build" script
154
if: github.ref_type == 'tag'
156
- name: Run "build-latest" script
157
if: github.ref_type == 'branch'
158
run: yarn run build-latest
159
- name: Build macOS binaries
160
run: yarn run build:macos
161
- name: Prepare release assets
164
GIT_COMMIT_LOG=`git log -1 --format='%ci %H %s'`
166
PACKAGE_NAME=`node -e "console.log(require('./src/package.json').name)"`
167
PACKAGE_VERSION=`node -e "console.log(require('./src/package.json').version)"`
168
mkdir -p releases/macos
169
cp -af "output/${PRODUCT_NAME}-${PACKAGE_VERSION}.dmg" "releases/macos/${PACKAGE_NAME}-${PACKAGE_VERSION}-macos-x64.dmg"
170
cp -af "output/${PRODUCT_NAME}-${PACKAGE_VERSION}-arm64.dmg" "releases/macos/${PACKAGE_NAME}-${PACKAGE_VERSION}-macos-arm64.dmg"
171
ls -al output releases/macos
172
if [[ "$GITHUB_REF_TYPE" == "branch" && "$GITHUB_REF_NAME" == "master" ]]; then
173
yarn github-release delete \
176
--tag="${GITHUB_REF_NAME}-latest" \
177
--release-name="${GITHUB_REF_NAME}" \
179
yarn github-release upload \
182
--tag="${GITHUB_REF_NAME}-latest" \
183
--release-name="${GITHUB_REF_NAME}" \
184
--body="${GIT_COMMIT_LOG}" \
187
#- name: Upload release assets
188
# uses: actions/github-script@v6
190
# github-token: ${{ secrets.GITHUB_TOKEN }}
192
# // https://github.com/actions/upload-release-asset/issues/47#issuecomment-659071145
193
# console.log('environment:', process.versions);
195
uses: softprops/action-gh-release@v1
196
if: startsWith(github.ref, 'refs/tags/')
202
name: Build Windows packages
203
runs-on: windows-latest
208
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
210
- name: Prepare VC++ Runtime
211
run: choco install -y vcredist2017
212
- name: Checkout code
213
uses: actions/checkout@v3
214
- name: Setup Node.js ${{ matrix.node-version }}
215
uses: actions/setup-node@v3
217
node-version: ${{ matrix.node-version }}
218
- name: Environment variables
220
# https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
221
echo "• GITHUB_REF_NAME=$GITHUB_REF_NAME"
222
echo "• GITHUB_REF_TYPE=$GITHUB_REF_TYPE" # `branch` or `tag`
223
echo "• GITHUB_RUN_NUMBER=$GITHUB_RUN_NUMBER"
224
echo "• GITHUB_SHA=$GITHUB_SHA"
225
echo "• RUNNER_ARCH=$RUNNER_ARCH"
226
echo "• RUNNER_NAME=$RUNNER_NAME"
227
echo "• RUNNER_OS=$RUNNER_OS"
228
echo "• RUNNER_TEMP=$RUNNER_TEMP"
229
echo "• RUNNER_TOOL_CACHE=$RUNNER_TOOL_CACHE"
230
- name: Install Yarn package manager
231
run: npm install -g yarn
232
- name: Install necessary dependencies and perform initial checks
238
- name: Run "build" script
239
if: github.ref_type == 'tag'
241
- name: Run "build-latest" script
242
if: github.ref_type == 'branch'
243
run: yarn run build-latest
244
- name: Build Windows binaries
245
run: yarn run build:windows
246
- name: Prepare release assets
249
GIT_COMMIT_LOG=`git log -1 --format='%ci %H %s'`
251
PACKAGE_NAME=`node -e "console.log(require('./src/package.json').name)"`
252
PACKAGE_VERSION=`node -e "console.log(require('./src/package.json').version)"`
253
mkdir -p releases/windows
254
cp -af "output/${PRODUCT_NAME} Setup ${PACKAGE_VERSION}.exe" "releases/windows/${PACKAGE_NAME}-${PACKAGE_VERSION}-windows-x64.exe"
255
ls -al output releases/windows
256
if [[ "$GITHUB_REF_TYPE" == "branch" && "$GITHUB_REF_NAME" == "master" ]]; then
257
yarn github-release delete \
260
--tag="${GITHUB_REF_NAME}-latest" \
261
--release-name="${GITHUB_REF_NAME}" \
263
yarn github-release upload \
266
--tag="${GITHUB_REF_NAME}-latest" \
267
--release-name="${GITHUB_REF_NAME}" \
268
--body="${GIT_COMMIT_LOG}" \
271
#- name: Upload release assets
272
# uses: actions/github-script@v6
274
# github-token: ${{ secrets.GITHUB_TOKEN }}
276
# // https://github.com/actions/upload-release-asset/issues/47#issuecomment-659071145
277
# console.log('environment:', process.versions);
279
uses: softprops/action-gh-release@v1
280
if: startsWith(github.ref, 'refs/tags/')