-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (107 loc) · 3.18 KB
/
Copy pathbuild-electron.yml
File metadata and controls
121 lines (107 loc) · 3.18 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
name: Build and Package Electron App
on:
push:
branches:
- main
tags:
- 'v*.*.*'
pull_request:
branches:
- main
workflow_dispatch:
permissions:
contents: read
jobs:
build:
name: Build & Package (${{ matrix.name }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: Windows
os: windows-latest
target: win
artifact: MukyuAI-Windows-Builds
paths: |
dist/*.7z
dist/*Setup*.exe
dist/*.blockmap
- name: macOS
os: macos-latest
target: mac
artifact: MukyuAI-macOS-Builds
paths: |
dist/*.dmg
dist/*.zip
- name: Linux
os: ubuntu-latest
target: linux
artifact: MukyuAI-Linux-Builds
paths: |
dist/*.AppImage
steps:
# 1. Checkout repository code
- name: Checkout Code
uses: actions/checkout@v7
# 2. Setup Node.js environment
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: 24
cache: 'npm'
# 3. Install project dependencies
- name: Install Dependencies
run: npm ci
- name: Install Linux packaging dependencies
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libfuse2
# 4. Run the Electron packaging script
# This compiles Next.js standalone and triggers electron-builder
- name: Build & Package Application
run: npm run electron:build -- --${{ matrix.target }}
env:
NODE_ENV: production
# 5. Compress win-unpacked directory into a .7z archive
# "7z" is pre-installed on the GitHub windows-latest runner
- name: Compress Unpacked Folder to 7z
if: runner.os == 'Windows'
shell: powershell
run: |
# Read version from package.json
$pkg = Get-Content package.json | ConvertFrom-Json
$version = $pkg.version
$archiveName = "dist/MukyuAI-v$version-win-x64.7z"
echo "Compressing dist/win-unpacked into $archiveName..."
7z a -t7z -mx=9 $archiveName ./dist/win-unpacked/*
# 6. Upload the build outputs as artifacts
- name: Upload Artifacts
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact }}
path: ${{ matrix.paths }}
if-no-files-found: error
retention-days: 7
release:
name: Create Draft Release
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download Build Artifacts
uses: actions/download-artifact@v8
with:
path: release-assets
merge-multiple: true
- name: Create Draft Release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "${GITHUB_REF_NAME}" \
release-assets/* \
--repo "${GITHUB_REPOSITORY}" \
--verify-tag \
--generate-notes \
--draft