-
-
Notifications
You must be signed in to change notification settings - Fork 49
150 lines (133 loc) · 5.85 KB
/
build-deploy.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
name: build-deploy
on:
push:
paths-ignore:
- '*.md'
- 'docs/**'
pull_request:
paths-ignore:
- '*.md'
- 'docs/**'
jobs:
release-electron:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
electron-arch-overrides: ['']
env:
USE_HARD_LINKS: false
defaults:
run:
shell: bash
steps:
- run: echo ${{github.event_name}}
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16.13.1'
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ./node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Make secrets.env.json
run: >
echo "{
\"twitter\": {
\"api_key\": \"$TWITTER_API_KEY\",
\"api_secret_key\": \"$TWITTER_API_SECRET_KEY\",
\"bearer_token\": \"$TWITTER_BEARER_TOKEN\"
},
\"reddit\": {
\"client_id\": \"$REDDIT_CLIENT_ID\"
},
\"google\": {
\"client_id\": \"$GOOGLE_CLIENT_ID\",
\"client_secret\": \"$GOOGLE_CLIENT_SECRET\"
}
}"
> secrets.env.json
env:
TWITTER_API_KEY: ${{secrets.TWITTER_API_KEY}}
TWITTER_API_SECRET_KEY: ${{secrets.TWITTER_API_SECRET_KEY}}
TWITTER_BEARER_TOKEN: ${{secrets.TWITTER_BEARER_TOKEN}}
REDDIT_CLIENT_ID: ${{secrets.REDDIT_CLIENT_ID}}
GOOGLE_CLIENT_ID: ${{secrets.GOOGLE_CLIENT_ID}}
GOOGLE_CLIENT_SECRET: ${{secrets.GOOGLE_CLIENT_SECRET}}
- run: mkdir ./dgraph-download
# Gets releases from dgraph
- uses: robinraju/release-downloader@v1.3
if: runner.os == 'Linux'
with:
repository: 'unigraph-dev/dgraph'
latest: true
fileName: 'dgraph_linux_amd64'
out-file-path: ./dgraph-download
- uses: robinraju/release-downloader@v1.3
if: runner.os == 'Windows'
with:
repository: 'unigraph-dev/dgraph'
latest: true
fileName: 'dgraph_windows_amd64.exe'
out-file-path: ./dgraph-download
- uses: robinraju/release-downloader@v1.3
if: runner.os == 'macOS'
with:
repository: 'unigraph-dev/dgraph'
latest: true
fileName: 'dgraph_darwin_amd64'
token: '${{secrets.PUBLIC_ACCESS_TOKEN}}'
out-file-path: ./dgraph-download
- uses: robinraju/release-downloader@v1.3
if: runner.os == 'macOS'
with:
repository: 'unigraph-dev/dgraph'
latest: true
fileName: 'dgraph_darwin_arm64'
token: '${{secrets.PUBLIC_ACCESS_TOKEN}}'
out-file-path: ./dgraph-download
- run: mv ./dgraph-download/dgraph_linux_amd64 ./dgraph-download/dgraph
if: runner.os == 'Linux'
- run: mv ./dgraph-download/dgraph_darwin_amd64 ./dgraph-download/dgraph && mv ./dgraph-download/dgraph_darwin_arm64 ./dgraph-download/dgraph_arm64
if: runner.os == 'macOS'
- run: mv ./dgraph-download/dgraph_windows_amd64.exe ./dgraph-download/dgraph.exe
if: runner.os == 'Windows'
- run: chmod +x ./dgraph-download/dgraph*
if: runner.os != 'Windows'
# Builds app
- run: yarn install --network-timeout 100000
- run: yarn prepare-electron
- name: Prepare for app notarization
if: startsWith(matrix.os, 'macos')
# Import Apple API key for app notarization on macOS
run: |
mkdir -p ~/private_keys/
echo '${{ secrets.mac_api_key }}' > ~/private_keys/AuthKey_${{ secrets.mac_api_key_id }}.p8
- name: Build and Publish Electron App
uses: samuelmeuli/action-electron-builder@master
with:
# Don't run `yarn build`, which otherwise happens by default
skip_build: true
# GitHub token, automatically provided to the action
# (No need to define this secret in the repo settings)
github_token: ${{ secrets.GITHUB_TOKEN }}
release: ${{ startsWith(github.ref, 'refs/tags/v') }}
package_root: 'packages/unigraph-dev-electron'
# macOS code signing certificate
mac_certs: ${{ secrets.mac_certs }}
mac_certs_password: ${{ secrets.mac_certs_password }}
args: ${{ matrix.electron-arch-overrides }}
env:
# macOS notarization API key
API_KEY_ID: ${{ secrets.mac_api_key_id }}
API_KEY_ISSUER_ID: ${{ secrets.mac_api_key_issuer_id }}