-
Notifications
You must be signed in to change notification settings - Fork 14
177 lines (153 loc) · 5.08 KB
/
release.yml
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
name: Build and Release
on:
workflow_dispatch:
inputs:
version:
description: 'Version number for the release (e.g., v1.0.0)'
required: true
release_name:
description: 'Name of the release'
required: true
default: 'New Release'
draft:
description: 'Create as draft release?'
required: false
default: true
type: boolean
prerelease:
description: 'Is this a prerelease?'
required: false
default: false
type: boolean
jobs:
build-windows:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: main
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
cache: 'pip'
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Create ui/.env file
run: |
echo "PUBLIC_WS_URL=127.0.0.1:5174/ws`nPUBLIC_DESKTOP_MODE=true" > ui/.env
- name: Install and build the Svelte frontend
run: |
cd ui
npm install
npm run build
cd ..
- name: Build Windows ZIP and MSI
run: |
python setup.py build
python setup.py bdist_msi
- name: Prepare dist directory
run: |
$version = "${{ github.event.inputs.version }}"
$distDir = "dist/psp-windows-$version"
if (Test-Path $distDir) { Remove-Item -Path $distDir -Recurse -Force }
New-Item -Path $distDir -ItemType Directory | Out-Null
Copy-Item -Path "build/exe.win-amd64-*\*" -Destination $distDir -Recurse -Force
Write-Host "Copied build files to $distDir"
shell: pwsh
- name: Create ZIP archive
run: |
$version = "${{ github.event.inputs.version }}"
$zipPath = "dist/PalworldSavePal-$version-windows-standalone.zip"
Compress-Archive -Path "dist/psp-windows-$version\*" -DestinationPath $zipPath -Force
Write-Host "Created ZIP archive at $zipPath"
shell: pwsh
- name: Rename MSI
run: |
$version = "${{ github.event.inputs.version }}"
$msiPath = "dist/PalworldSavePal-$version-windows-installer.msi"
Move-Item -Path "dist/*.msi" -Destination $msiPath -Force
Write-Host "Renamed MSI to $msiPath"
shell: pwsh
- name: Upload Windows ZIP artifact
uses: actions/upload-artifact@v4
with:
name: windows-zip
path: dist/*.zip
- name: Upload Windows MSI artifact
uses: actions/upload-artifact@v4
with:
name: windows-msi
path: dist/*.msi
build-macos:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: main
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Create ui/.env file
run: |
printf "PUBLIC_WS_URL=127.0.0.1:5174/ws\nPUBLIC_DESKTOP_MODE=true" > ui/.env
- name: Install and build the Svelte frontend
run: |
cd ui
npm install
npm run build
cd ..
- name: Build macOS DMG
run: |
python setup.py bdist_dmg
- name: Rename macOS DMG
run: |
version="${{ github.event.inputs.version }}"
dmg_path="dist/PalworldSavePal-$version-macos-installer.dmg"
mkdir -p dist
mv build/*.dmg "$dmg_path"
echo "Renamed DMG to $dmg_path"
- name: Upload macOS DMG artifact
uses: actions/upload-artifact@v4
with:
name: macos-dmg
path: dist/*.dmg
create-release:
needs: [build-windows, build-macos]
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.event.inputs.version }}
name: ${{ github.event.inputs.release_name }}
draft: ${{ github.event.inputs.draft }}
prerelease: ${{ github.event.inputs.prerelease }}
files: |
artifacts/windows-zip/*.zip
artifacts/windows-msi/*.msi
artifacts/macos-dmg/*.dmg
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}