Repository navigation
101 lines (97 loc) · 3.72 KB
/
Copy pathrelease.yml
File metadata and controls
101 lines (97 loc) · 3.72 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
name: Release
on:
push:
tags:
- 'v*'
jobs:
build-mac:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
- uses: actions/cache@v4
with:
path: |
~/Library/Caches/electron
~/Library/Caches/electron-builder
key: ${{ runner.os }}-electron-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-electron-
- run: npm ci
# The full gate, as on Windows: a release is never built from code that
# fails it. npm test builds the app as its first step.
- run: npm test
- name: Validate mac signing secrets
run: |
test -n "$MAC_CSC_LINK" || { echo "MAC_CSC_LINK is missing"; exit 1; }
test -n "$MAC_CSC_KEY_PASSWORD" || { echo "MAC_CSC_KEY_PASSWORD is missing"; exit 1; }
env:
MAC_CSC_LINK: ${{ secrets.MAC_CSC_LINK }}
MAC_CSC_KEY_PASSWORD: ${{ secrets.MAC_CSC_KEY_PASSWORD }}
- run: npx electron-builder --mac --publish always
env:
DEBUG: electron-osx-sign*,electron-builder
GH_TOKEN: ${{ secrets.GH_TOKEN }}
CSC_LINK: 'data:application/x-pkcs12;base64,${{ secrets.MAC_CSC_LINK }}'
CSC_KEY_PASSWORD: ${{ secrets.MAC_CSC_KEY_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
EP_PRE_RELEASE: false
# Upload into a draft. A release that is visible before every
# platform has uploaded becomes "latest" with only some of its
# assets, and the other platform's updater 404s on its missing
# channel file. The publish job below flips the draft once both
# builds have landed.
EP_DRAFT: true
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
- uses: actions/cache@v4
with:
path: |
~\AppData\Local\electron\Cache
~\AppData\Local\electron-builder\Cache
key: ${{ runner.os }}-electron-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-electron-
- run: npm ci
- run: npm test
# Windows signing is optional, matching the existing release channel.
# Electron-builder signs when credentials exist and otherwise builds unsigned.
- run: npx electron-builder --win --publish always
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
WIN_CSC_LINK: ${{ secrets.WIN_CSC_LINK }}
WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }}
EP_PRE_RELEASE: false
EP_DRAFT: true
# Only now does the release become visible to updaters, with mac and
# Windows assets both present.
publish:
needs: [build-mac, build-windows]
runs-on: ubuntu-latest
steps:
- name: Verify both platforms uploaded, then publish
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
TAG: ${{ github.ref_name }}
run: |
assets=$(gh release view "$TAG" --repo flowtricks/stacki-releases \
--json assets --jq '[.assets[].name] | join(" ")')
echo "assets: $assets"
for required in latest-mac.yml latest.yml; do
case " $assets " in
*" $required "*) ;;
*) echo "missing $required — refusing to publish"; exit 1 ;;
esac
done
gh release edit "$TAG" --repo flowtricks/stacki-releases --draft=false --latest