Skip to content

Commit e356922

Browse files
committed
feat: implement new release.yaml
1 parent 182a7d9 commit e356922

1 file changed

Lines changed: 71 additions & 52 deletions

File tree

.github/workflows/release.yaml

Lines changed: 71 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111
type: boolean
1212
default: true
1313

14+
env:
15+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
16+
1417
jobs:
1518
determine-version:
1619
name: Determine Version
@@ -25,6 +28,27 @@ jobs:
2528
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
2629
echo "is_draft=${{ github.event.inputs.draft }}" >> $GITHUB_OUTPUT
2730
31+
create-draft-release:
32+
name: Create Draft Release
33+
needs: determine-version
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- name: Create release
39+
shell: bash
40+
run: |
41+
DRAFT_FLAG=""
42+
if [ "${{ needs.determine-version.outputs.is_draft }}" = "true" ]; then
43+
DRAFT_FLAG="--draft"
44+
fi
45+
gh release create v${{ needs.determine-version.outputs.version }} \
46+
--title "Control Station v${{ needs.determine-version.outputs.version }}" \
47+
--generate-notes \
48+
$DRAFT_FLAG
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
2852
build-frontend:
2953
name: Build Frontend
3054
needs: determine-version
@@ -53,9 +77,9 @@ jobs:
5377
path: frontend/testing-view/dist/**
5478
retention-days: 1
5579

56-
build-and-package:
57-
name: Package - ${{ matrix.os }}
58-
needs: [determine-version, build-frontend]
80+
build-backend:
81+
name: Build Backend - ${{ matrix.os }}
82+
needs: determine-version
5983
runs-on: ${{ matrix.os }}
6084
strategy:
6185
fail-fast: true
@@ -92,10 +116,47 @@ jobs:
92116
CGO_ENABLED: 1
93117
GOARCH: ${{ matrix.goarch }}
94118

119+
- uses: actions/upload-artifact@v4
120+
with:
121+
name: backend-${{ matrix.os }}
122+
path: electron-app/binaries/${{ matrix.binary }}
123+
retention-days: 1
124+
125+
package-and-upload:
126+
name: Package & Upload - ${{ matrix.os }}
127+
needs: [determine-version, create-draft-release, build-frontend, build-backend]
128+
runs-on: ${{ matrix.os }}
129+
strategy:
130+
fail-fast: true
131+
matrix:
132+
include:
133+
- os: windows-latest
134+
binary: backend-windows-amd64.exe
135+
- os: ubuntu-latest
136+
binary: backend-linux-amd64
137+
- os: macos-latest
138+
binary: backend-darwin-arm64
139+
- os: macos-15-intel
140+
binary: backend-darwin-amd64
141+
steps:
142+
- uses: actions/checkout@v4
143+
144+
- name: Download backend binary
145+
uses: actions/download-artifact@v4
146+
with:
147+
name: backend-${{ matrix.os }}
148+
path: electron-app/binaries
149+
95150
- name: Set executable permissions (Unix)
96151
if: runner.os != 'Windows'
97152
run: chmod +x electron-app/binaries/*
98153

154+
- name: Download frontend dist
155+
uses: actions/download-artifact@v4
156+
with:
157+
name: frontend-dist
158+
path: electron-app/renderer/testing-view
159+
99160
- uses: pnpm/action-setup@v4
100161
with:
101162
version: 10.26.0
@@ -110,12 +171,6 @@ jobs:
110171
shell: bash
111172
run: pnpm version ${{ needs.determine-version.outputs.version }} --no-git-tag-version
112173

113-
- name: Download frontend dist
114-
uses: actions/download-artifact@v4
115-
with:
116-
name: frontend-dist
117-
path: electron-app/renderer/testing-view
118-
119174
- name: Install Electron dependencies
120175
working-directory: electron-app
121176
run: pnpm install
@@ -128,48 +183,12 @@ jobs:
128183
CSC_IDENTITY_AUTO_DISCOVERY: false
129184
ELECTRON_BUILDER_PUBLISH: never
130185

131-
- uses: actions/upload-artifact@v4
132-
with:
133-
name: electron-${{ runner.os }}-${{ runner.arch }}
134-
path: |
135-
electron-app/dist/*.exe
136-
electron-app/dist/*.AppImage
137-
electron-app/dist/*.deb
138-
electron-app/dist/*.dmg
139-
electron-app/dist/*.zip
140-
electron-app/dist/*.yml
141-
electron-app/dist/*.blockmap
142-
!electron-app/dist/*-unpacked
143-
!electron-app/dist/mac
144-
!electron-app/dist/win-unpacked
145-
!electron-app/dist/linux-unpacked
146-
if-no-files-found: error
147-
retention-days: 1
148-
149-
create-release:
150-
name: Create GitHub Release
151-
needs: [build-and-package, determine-version]
152-
runs-on: ubuntu-latest
153-
steps:
154-
- uses: actions/checkout@v4
155-
156-
- name: Download all electron artifacts
157-
uses: actions/download-artifact@v4
158-
with:
159-
pattern: electron-*
160-
path: dist
161-
merge-multiple: true
162-
163-
- name: Display structure
164-
run: ls -laR dist/
165-
166-
- name: Create Release
167-
uses: softprops/action-gh-release@v2
168-
with:
169-
tag_name: v${{ needs.determine-version.outputs.version }}
170-
name: Control Station v${{ needs.determine-version.outputs.version }}
171-
draft: ${{ needs.determine-version.outputs.is_draft }}
172-
generate_release_notes: true
173-
files: dist/**/*
186+
- name: Upload to GitHub Release
187+
shell: bash
188+
run: |
189+
find electron-app/dist -maxdepth 1 -type f \
190+
\( -name "*.exe" -o -name "*.AppImage" -o -name "*.deb" \
191+
-o -name "*.dmg" -o -name "*.zip" -o -name "*.yml" -o -name "*.blockmap" \) \
192+
| xargs gh release upload v${{ needs.determine-version.outputs.version }} --clobber
174193
env:
175194
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)