1+ name : Build and Release
2+
3+ on :
4+ push :
5+ tags :
6+ - ' v*'
7+
8+ permissions :
9+ contents : write
10+
11+ jobs :
12+ build :
13+ name : Build on ${{ matrix.os }}
14+ runs-on : ${{ matrix.os }}
15+ strategy :
16+ matrix :
17+ os : [ubuntu-latest, windows-latest, macos-latest]
18+ include :
19+ - os : ubuntu-latest
20+ asset_name : fracsim-linux-amd64
21+ icon : 🐧 # Linux 图标
22+ - os : windows-latest
23+ asset_name : fracsim-windows-amd64.exe
24+ icon : 🪟 # Windows 图标
25+ - os : macos-latest
26+ asset_name : fracsim-macos-arm64
27+ icon : 🍎 # macOS 图标
28+
29+ steps :
30+ - uses : actions/checkout@v4
31+ - uses : actions/setup-python@v5
32+ with :
33+ python-version : ' 3.10'
34+ - run : pip install pyinstaller mmh3
35+ - run : pyinstaller --onefile --name fracsim ./fracsim/main.py
36+ - name : Upload artifact (prepare for release)
37+ uses : actions/upload-artifact@v4
38+ with :
39+ name : ${{ matrix.asset_name }}
40+ path : ./dist/fracsim${{ matrix.os == 'windows-latest' && '.exe' || '' }}
41+
42+ release :
43+ name : Create Release
44+ needs : build
45+ runs-on : ubuntu-latest
46+ steps :
47+ - name : Download all artifacts
48+ uses : actions/download-artifact@v4
49+ with :
50+ path : ./artifacts
51+
52+ - name : Generate Release Body
53+ id : body
54+ run : |
55+ cat > release_body.md << EOF
56+ ## 📥 Downloads
57+ | Platform | Download Link |
58+ |------|----------|
59+ | 🐧 Linux | [fracsim-linux-amd64](./attachments/fracsim-linux-amd64) |
60+ | 🪟 Windows | [fracsim-windows-amd64.exe](./attachments/fracsim-windows-amd64.exe) |
61+ | 🍎 macOS | [fracsim-macos-arm64](./attachments/fracsim-macos-arm64) |
62+ EOF
63+ echo "body<<EOF" >> $GITHUB_OUTPUT
64+ cat release_body.md >> $GITHUB_OUTPUT
65+ echo "EOF" >> $GITHUB_OUTPUT
66+
67+ - name : Create Release and Upload Assets
68+ uses : softprops/action-gh-release@v2
69+ with :
70+ files : ./artifacts/**/*
71+ body_path : release_body.md
0 commit comments