-
Notifications
You must be signed in to change notification settings - Fork 64
116 lines (104 loc) · 4.23 KB
/
build.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
name: Publish snapshot of master branch
on:
push:
branches:
- 'master'
jobs:
release:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v3
with:
node-version: 16
- name: Set snapshot version
shell: bash
run: echo "PACKAGE_VERSION=`npm pkg get version|tr -d '\"'`" >> $GITHUB_ENV
- name: Cancel job if the package version doesn't match "-snapshot$"
uses: andymckay/[email protected]
# We only want to build master if we have a snapshot version
# ..otherwise, building main will clobber releases...sometimes
# due to a race condition.
if: ${{ !endsWith( env.PACKAGE_VERSION, '-snapshot') }}
- name: Install windows certificates
if: matrix.os == 'windows-latest'
env:
CERT_FILE: ${{ secrets.WIN_CERT }}
shell: bash
run: |
echo "$CERT_FILE" > "./cert-b64.pfx"
certutil -decode "./cert-b64.pfx" "cert.pfx"
ls -al
- name: Install the Apple certificate and provisioning profile
if: matrix.os == 'macos-latest'
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.mac_certs }}
P12_PASSWORD: ${{ secrets.mac_certs_password }}
KEYCHAIN_PASSWORD: ${{ secrets.mac_certs_password }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
- name: Install udev-dev
run: sudo apt update && sudo apt install libudev-dev
if: runner.os == 'Linux'
- name: Set up yarn network timeout
run: yarn config set network-timeout 1000000 -g
- name: Install Yarn dependencies
shell: bash
env:
YARN_GPG: no
GITHUB_RUN_NUMBER: ${{ github.run_number }}
run: yarn
- name: Release (macos)
if: matrix.os == 'macos-latest'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: yarn run make --arch=universal
- name: Release (non-macos)
shell: bash
if: matrix.os != 'macos-latest'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.win_cert_password }}
run: yarn run make
- name: Generate latest.yml upgrade files
shell: bash
run: |
find out
mkdir out/artifacts
find out/make/zip -name \*.zip -exec cp {} out/artifacts \;
find out/make -name \*.dmg -exec cp {} out/artifacts \;
find out/make -name \*.AppImage -exec cp {} out/artifacts \;
cd out/artifacts
# rename our artifacts to "-snapshot"
# for i in ./*.* ; do mv "$i" "${i/`npm pkg get version|tr -d '\"'`/snapshot}" ; done
node ../../tools/generate-latest.js
- name: Upload latest.yml upgrade files
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: out/artifacts/*.{zip,dmg,AppImage,yml}
tag: v${{ env.PACKAGE_VERSION }}
file_glob: true
prerelease: true
overwrite: true