-
Notifications
You must be signed in to change notification settings - Fork 136
164 lines (146 loc) · 5.24 KB
/
Copy pathdesktop-release.yml
File metadata and controls
164 lines (146 loc) · 5.24 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
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
name: Desktop Release
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
tag:
description: Tag to build (e.g. v1.5.36)
required: true
permissions:
contents: write
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
name: macOS
script: electron:build:mac
- os: windows-latest
name: Windows
script: electron:build:win
- os: ubuntu-latest
name: Linux
script: electron:build:linux
runs-on: ${{ matrix.os }}
timeout-minutes: 60
name: ${{ matrix.name }}
steps:
- name: Resolve tag
id: resolve_tag
shell: bash
env:
INPUT_TAG: ${{ github.event.inputs.tag }}
REF_NAME: ${{ github.ref_name }}
run: |
TAG_NAME="${INPUT_TAG:-$REF_NAME}"
case "$TAG_NAME" in
v[0-9]*.[0-9]*.[0-9]*|v[0-9]*.[0-9]*.[0-9]*-*)
;;
*)
echo "Refusing to build non-version tag: $TAG_NAME" >&2
exit 1
;;
esac
echo "tag=$TAG_NAME" >> "$GITHUB_OUTPUT"
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ steps.resolve_tag.outputs.tag }}
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
- name: Setup Python (for node-gyp)
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Sync package version with tag
shell: bash
env:
TAG: ${{ steps.resolve_tag.outputs.tag }}
run: |
TAG_VERSION="${TAG#v}"
CURRENT_VERSION="$(node -p "require('./package.json').version")"
if [ "$CURRENT_VERSION" != "$TAG_VERSION" ]; then
npm pkg set version="$TAG_VERSION"
fi
- name: Install dependencies
run: npm ci
env:
CI: 'true'
- name: Install Linux system deps
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libopenjp2-tools rpm fakeroot dpkg
- name: Install macOS system deps
if: matrix.os == 'macos-latest'
run: |
brew install pkg-config xz
- name: Prepare safe Windows HOME
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path "D:\\swarmclaw-home" | Out-Null
"USERPROFILE=D:\\swarmclaw-home" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
"HOMEDRIVE=D:" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
"HOMEPATH=\\swarmclaw-home" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
- name: Check macOS signing inputs
if: matrix.os == 'macos-latest'
shell: bash
env:
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
run: |
set -euo pipefail
has_certificate=false
has_apple_id_notary=false
has_api_key_notary=false
if [ -n "${CSC_LINK:-}" ] && [ -n "${CSC_KEY_PASSWORD:-}" ]; then
has_certificate=true
fi
if [ -n "${APPLE_ID:-}" ] && [ -n "${APPLE_APP_SPECIFIC_PASSWORD:-}" ] && [ -n "${APPLE_TEAM_ID:-}" ]; then
has_apple_id_notary=true
fi
if [ -n "${APPLE_API_KEY:-}" ] && [ -n "${APPLE_API_KEY_ID:-}" ] && [ -n "${APPLE_API_ISSUER:-}" ]; then
has_api_key_notary=true
fi
if [ "$has_certificate" = true ] && { [ "$has_apple_id_notary" = true ] || [ "$has_api_key_notary" = true ]; }; then
echo "Developer ID signing and notarization inputs are configured."
else
echo "Developer ID signing and notarization inputs are incomplete; macOS artifacts will remain ad-hoc signed."
fi
- name: Build desktop app
run: npm run ${{ matrix.script }} -- --publish
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
NEXT_TELEMETRY_DISABLED: '1'
- name: Upload build logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: build-logs-${{ matrix.name }}
path: |
release/**/*.log
release/builder-debug.yml
if-no-files-found: ignore