-
-
Notifications
You must be signed in to change notification settings - Fork 323
170 lines (165 loc) · 6.67 KB
/
_publish-electron.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
name: electron-publish-workflow
on:
workflow_call:
inputs:
node_version:
description: 'Node.js version to use'
required: true
type: string
build:
description: 'Whether to build'
required: false
default: true
type: boolean
publish:
description: 'Whether to publish'
required: false
default: true
type: boolean
publish_chocolatey:
description: 'Whether to publish to Chocolatey'
required: false
default: true
type: boolean
outputs:
# Map the workflow output(s) to job output(s)
version:
description: 'Built/published version from the workflow'
value: ${{ jobs.electron.outputs.version }}
workflow_dispatch:
inputs:
node_version:
description: 'Node.js version to use'
required: true
type: string
build:
description: 'Whether to build'
required: false
default: true
type: boolean
publish:
description: 'Whether to publish'
required: false
default: true
type: boolean
publish_chocolatey:
description: 'Whether to publish to Chocolatey'
required: false
default: true
type: boolean
jobs:
electron:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
# Map the job output(s) to step output(s)
outputs:
version: ${{ steps.getversion.outputs.version }}
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ inputs.node_version }} on ${{ matrix.os }}
uses: actions/setup-node@v1
with:
node-version: ${{ inputs.node_version }}
- uses: maxim-lobanov/setup-xcode@v1
if: startsWith(matrix.os, 'macos')
with:
xcode-version: latest-stable
- run: yarn --frozen-lockfile --network-timeout 1000000
- uses: nick-invision/retry@v2
with:
timeout_minutes: 20
max_attempts: 3
command: yarn lerna bootstrap
- name: Install Snapcraft
uses: samuelmeuli/action-snapcraft@v2
if: startsWith(matrix.os, 'ubuntu')
env:
SNAPCRAFT_TOKEN: ${{ secrets.SNAPCRAFT_TOKEN }}
- 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.apple_api_key }}' > ~/private_keys/AuthKey_${{ secrets.apple_api_key_id }}.p8
- name:
Build/release Electron app
# disable for macos not in master branch, because code signing is skipped in pull requests
if: ${{ inputs.publish || !(startsWith(matrix.os, 'macos') && github.ref != 'refs/heads/master') }}
id: build-electron
uses: CryogenicPlanet/action-electron-builder@v2 # Using CryogenicPlanet until the main action adds skip_install
with:
github_token: ${{ secrets.github_token }}
package_root: packages/altair-electron/
skip_build: true
skip_install: true
mac_certs: ${{ secrets.mac_certs }}
mac_certs_password: ${{ secrets.mac_certs_password }}
args: ${{ inputs.publish && '--publish always' || '--publish never' }}
max_attempts: 3
env:
# macOS notarization API key
# https://www.codiga.io/blog/notarize-sign-electron-app/
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
APPLEIDPASS: ${{ secrets.APPLE_ID_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
# chocolatey
- name: Read VERSION file
id: getversion
run: echo "::set-output name=version::$(cat VERSION)"
- name: Add mask
run: |
echo "::add-mask::${{ secrets.CHOCOLATEY_API_KEY }}"
- name: chocolatey pack
if: startsWith(matrix.os, 'windows')
uses: crazy-max/[email protected]
with:
args: pack chocolatey\altair-graphql.nuspec
# - name: chocolatey install (test choco packaging)
# if: startsWith(matrix.os, 'windows')
# uses: crazy-max/[email protected]
# with:
# args: install altair-graphql --version="${{ steps.getversion.outputs.version }}" --source="altair-graphql.${{ steps.getversion.outputs.version }}.nupkg"
# FIXME: chocolatey push is failing in the CI with the "request too large" error.
# It is unclear to me what the payload size limit is for the choco push command (the best info I could find about this is: https://github.com/chocolatey-community/chocolatey-packages/issues/1179).
# If this is really a problem, someone needs to figure out a proper solution for this (most likely changing it to a non-embedded package, or some other solution I'm not aware of).
- name: chocolatey push
if: startsWith(matrix.os, 'windows') && ${{ inputs.publish_chocolatey }} && ${{ inputs.publish }}
continue-on-error: true
uses: crazy-max/[email protected]
with:
args: push altair-graphql.${{ steps.getversion.outputs.version }}.nupkg -s https://push.chocolatey.org/ -k="'${{ secrets.CHOCOLATEY_API_KEY }}'"
- name: Upload source maps to Sentry (app)
if: startsWith(matrix.os, 'ubuntu')
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
environment: ${{ inputs.publish && 'production' || '' }}
sourcemaps: packages/altair-app/dist/
version: ${{ inputs.publish && steps.getversion.outputs.version || '' }}
url_prefix: 'altair://-'
finalize: false
- name: Upload source maps to Sentry (electron)
if: startsWith(matrix.os, 'ubuntu')
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
environment: ${{ inputs.publish && 'production' || '' }}
sourcemaps: packages/altair-electron/dist/
version: ${{ inputs.publish && steps.getversion.outputs.version || '' }}
url_prefix: 'app:///dist'
- name: Upload electron builds
if: always()
uses: actions/upload-artifact@v4
with:
name: electron-builds-${{ matrix.os }}
path: packages/altair-electron/out/**