Repository navigation
163 lines (139 loc) · 4.88 KB
/
Copy pathrelease.yml
File metadata and controls
163 lines (139 loc) · 4.88 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
name: Build release
on:
push:
tags:
- "*"
workflow_dispatch:
inputs:
tag_name:
description: "Existing tag to build and publish, for example v0.2.3"
required: true
type: string
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.platform }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
platform: windows-x64
archive: RhythmFlow-windows-x64.zip
- os: macos-latest
platform: macos
archive: RhythmFlow-macos.zip
steps:
- name: Check out repository
uses: actions/checkout@v7
with:
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag_name || github.ref_name }}
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install pyinstaller
- name: Run tests
run: python -m unittest discover -s tests
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: "24"
package-manager-cache: false
- name: Normalize npm metadata
shell: bash
run: |
node <<'NODE'
const fs = require("node:fs");
const packageJsonPath = "package.json";
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
packageJson.scripts = {
prepare: "vp config || vp config --no-hooks",
build: "vp build",
check: "vp check",
test: "vp test",
dev: "vp dev",
preview: "vp preview",
...packageJson.scripts,
};
if (packageJson.devDependencies?.vite === "catalog:") {
packageJson.devDependencies.vite = "npm:@voidzero-dev/vite-plus-core@0.2.2";
}
if (packageJson.devDependencies?.["vite-plus"] === "catalog:") {
packageJson.devDependencies["vite-plus"] = "0.2.2";
}
delete packageJson.devEngines;
packageJson.packageManager = "npm@11.16.0";
fs.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`);
fs.writeFileSync(".npmrc", "legacy-peer-deps=true\n");
fs.rmSync("pnpm-workspace.yaml", { force: true });
NODE
- name: Build front-end
shell: bash
run: |
if [ ! -f package-lock.json ]; then
npm install --package-lock-only --ignore-scripts --legacy-peer-deps
fi
npm ci --legacy-peer-deps
npm run build
- name: Build executable
run: python -m PyInstaller --noconfirm rhythmflow.spec
- name: Package Windows build (one-dir exe)
if: runner.os == 'Windows'
shell: pwsh
run: |
if (-not (Test-Path "dist/RhythmFlow/RhythmFlow.exe")) {
throw "Build output not found: dist/RhythmFlow/RhythmFlow.exe"
}
New-Item -ItemType Directory -Force release | Out-Null
Compress-Archive -Path "dist/RhythmFlow" -DestinationPath "release/${{ matrix.archive }}" -Force
- name: Package macOS build (.app bundle)
if: runner.os == 'macOS'
shell: bash
run: |
if [ ! -d "dist/RhythmFlow.app" ]; then
echo "Build output not found: dist/RhythmFlow.app"
exit 1
fi
mkdir -p release
ditto -c -k --keepParent "dist/RhythmFlow.app" "release/${{ matrix.archive }}"
- name: Upload workflow artifact
uses: actions/upload-artifact@v7
with:
name: RhythmFlow-${{ matrix.platform }}
path: release/${{ matrix.archive }}
if-no-files-found: error
retention-days: 30
release:
name: Publish GitHub release
needs: build
runs-on: ubuntu-latest
if: ${{ needs.build.result == 'success' && (github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/')) }}
steps:
- name: Download workflow artifacts
uses: actions/download-artifact@v8
continue-on-error: true
with:
pattern: RhythmFlow-*
path: release-assets
merge-multiple: true
- name: Check release assets
shell: bash
run: |
if ! find release-assets -type f -name "*.zip" | grep -q .; then
echo "No release assets were built successfully."
exit 1
fi
- name: Publish release assets
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ github.event_name == 'workflow_dispatch' && inputs.tag_name || github.ref_name }}
generate_release_notes: true
files: release-assets/*