-
Notifications
You must be signed in to change notification settings - Fork 2
225 lines (201 loc) · 7.04 KB
/
release.yaml
File metadata and controls
225 lines (201 loc) · 7.04 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
name: Release Electron App
on:
# Commented because provokes duplicated builds
# push:
# tags:
# - "v*.*.*"
workflow_dispatch:
inputs:
version:
description: "Release version (e.g., 1.0.0)"
required: true
draft:
description: "Create as draft release"
type: boolean
default: true
jobs:
# Determine version once on Linux
determine-version:
name: Determine Version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
is_draft: ${{ steps.get_version.outputs.is_draft }}
steps:
- name: Determine version
id: get_version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
echo "is_draft=${{ github.event.inputs.draft }}" >> $GITHUB_OUTPUT
else
echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
echo "is_draft=false" >> $GITHUB_OUTPUT
fi
echo "Version determined: $(cat $GITHUB_OUTPUT | grep version)"
build-electron:
name: Build Electron App
needs: determine-version
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [windows-latest, ubuntu-latest, macos-latest, macos-15-intel]
steps:
- name: Debug all contexts
run: |
echo "=== Runner Context ==="
echo "runner.os: ${{ runner.os }}"
echo "runner.arch: ${{ runner.arch }}"
echo "runner.name: ${{ runner.name }}"
echo "runner.temp: ${{ runner.temp }}"
echo "runner.workspace: ${{ runner.workspace }}"
echo ""
echo "=== Matrix Context ==="
echo "matrix.os: ${{ matrix.os }}"
echo "matrix.platform: ${{ matrix.platform }}"
echo "matrix.arch: ${{ matrix.arch }}"
echo ""
echo "=== Environment Variables ==="
echo "RUNNER_OS: $RUNNER_OS"
echo "RUNNER_ARCH: $RUNNER_ARCH"
echo "RUNNER_NAME: $RUNNER_NAME"
- name: Checkout repository
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10.26.0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"
# Update package.json with release version
- name: Update version in package.json
working-directory: electron-app
shell: bash
run: |
pnpm version ${{ needs.determine-version.outputs.version }} --no-git-tag-version
echo "Updated version to:"
cat package.json | grep version
# Download ONLY the appropriate backend for this platform
- name: Download Linux backend
if: runner.os == 'Linux'
uses: dawidd6/action-download-artifact@v3
with:
workflow: build.yaml
branch: production
workflow_conclusion: success
name: backend-linux
path: electron-app/binaries
- name: Download Windows backend
if: runner.os == 'Windows'
uses: dawidd6/action-download-artifact@v3
with:
workflow: build.yaml
branch: production
workflow_conclusion: success
name: backend-windows
path: electron-app/binaries
- name: Download macOS Intel backend
if: runner.os == 'macOS' && runner.arch == 'X64'
uses: dawidd6/action-download-artifact@v3
with:
workflow: build.yaml
branch: production
workflow_conclusion: success
name: backend-macos-intel
path: electron-app/binaries
- name: Download macOS ARM64 backend
if: runner.os == 'macOS' && runner.arch == 'ARM64'
uses: dawidd6/action-download-artifact@v3
with:
workflow: build.yaml
branch: production
workflow_conclusion: success
name: backend-macos-arm64
path: electron-app/binaries
# Download frontend builds from latest build
# TODO: Uncomment when competition view is ready
# - name: Download competition-view
# uses: dawidd6/action-download-artifact@v3
# with:
# workflow: build.yaml
# branch: production
# workflow_conclusion: success
# name: competition-view
# path: electron-app/renderer/competition-view
- name: Download testing-view
uses: dawidd6/action-download-artifact@v3
with:
workflow: build.yaml
branch: production
workflow_conclusion: success
name: testing-view
path: electron-app/renderer/testing-view
- name: Set executable permissions (Unix)
if: runner.os != 'Windows'
run: chmod +x electron-app/binaries/*
- name: Install Electron dependencies
working-directory: electron-app
run: pnpm install
- name: Build Electron distribution
working-directory: electron-app
run: pnpm run dist
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CSC_IDENTITY_AUTO_DISCOVERY: false
ELECTRON_BUILDER_PUBLISH: never
- name: Display structure (Windows)
if: runner.os == 'Windows'
working-directory: electron-app
shell: pwsh
run: Get-ChildItem -Recurse dist/ | Select-Object FullName
- name: Display structure (Unix)
if: runner.os != 'Windows'
working-directory: electron-app
run: ls -laR dist/
- name: Upload electron artifacts
uses: actions/upload-artifact@v4
with:
name: electron-${{ runner.os }}-${{ runner.arch }}
path: |
electron-app/dist/*.exe
electron-app/dist/*.AppImage
electron-app/dist/*.deb
electron-app/dist/*.dmg
electron-app/dist/*.zip
electron-app/dist/*.yml
electron-app/dist/*.blockmap
!electron-app/dist/*-unpacked
!electron-app/dist/mac
!electron-app/dist/win-unpacked
!electron-app/dist/linux-unpacked
if-no-files-found: error
retention-days: 7
# Create GitHub Release
create-release:
name: Create GitHub Release
needs: [build-electron, determine-version]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download all electron artifacts
uses: actions/download-artifact@v4
with:
pattern: electron-*
path: dist
merge-multiple: true
- name: Display structure
run: ls -laR dist/
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.determine-version.outputs.version }}
name: Hyperloop Control Station v${{ needs.determine-version.outputs.version }}
draft: ${{ needs.determine-version.outputs.is_draft }}
generate_release_notes: true
files: dist/**/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}