forked from legendary-gl/legendary
-
Notifications
You must be signed in to change notification settings - Fork 10
172 lines (142 loc) · 4.29 KB
/
Copy pathrelease.yml
File metadata and controls
172 lines (142 loc) · 4.29 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
164
165
166
167
168
169
170
171
172
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: 'Tag to release (e.g. v0.20.42). Must already exist.'
required: true
type: string
permissions:
contents: write
jobs:
pyinstaller:
name: Build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-2025
asset_name: legendary-windows-x86_64.exe
- os: windows-11-arm
asset_name: legendary-windows-arm64.exe
- os: macos-15-intel
asset_name: legendary-macos-x86_64
- os: macos-15
asset_name: legendary-macos-arm64
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.tag || github.ref }}
- uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Dependencies
run: pip3 install --requirement requirements.txt
- name: Build tools
run: pip3 install --upgrade setuptools pyinstaller
- name: Optional dependencies (WebView)
run: pip3 install --upgrade pywebview
if: runner.os != 'macOS'
- name: Set strip option on non-Windows
id: strip
run: echo "option=--strip" >> $GITHUB_OUTPUT
if: runner.os != 'Windows'
- name: Build
working-directory: legendary
run: pyinstaller
--onefile
--name legendary
${{ steps.strip.outputs.option }}
-i ../assets/windows_icon.ico
cli.py
env:
PYTHONOPTIMIZE: 1
- name: Rename artifact (Windows)
if: runner.os == 'Windows'
shell: bash
run: mv legendary/dist/legendary.exe legendary/dist/${{ matrix.asset_name }}
- name: Rename artifact (macOS)
if: runner.os == 'macOS'
run: mv legendary/dist/legendary legendary/dist/${{ matrix.asset_name }}
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}
path: legendary/dist/${{ matrix.asset_name }}
if-no-files-found: error
zipapp:
name: Build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-24.04
asset_name: legendary-linux-x86_64
- os: ubuntu-24.04-arm
asset_name: legendary-linux-arm64
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.tag || github.ref }}
- uses: actions/setup-python@v5
with:
python-version: '3.13'
- run: mkdir -p build dist
- name: Dependencies
run: pip3 install --requirement requirements.txt --target build
- run: cp -r legendary build
- run: cp zipapp_main.py build/__main__.py
- name: Build
run: python -m zipapp
--output dist/${{ matrix.asset_name }}
--python "/usr/bin/env python3"
--compress
build
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}
path: dist/${{ matrix.asset_name }}
if-no-files-found: error
sdist:
name: Build sdist + wheel
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.tag || github.ref }}
- uses: actions/setup-python@v5
with:
python-version: '3.13'
- run: pip3 install --upgrade build
- run: python -m build
- uses: actions/upload-artifact@v4
with:
name: python-dist
path: dist/*
if-no-files-found: error
release:
name: Publish GitHub Release
needs: [pyinstaller, zipapp, sdist]
runs-on: ubuntu-24.04
steps:
- name: Resolve tag
id: tag
run: echo "name=${{ inputs.tag || github.ref_name }}" >> $GITHUB_OUTPUT
- uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: List artifacts
run: ls -la artifacts
- uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag.outputs.name }}
name: ${{ steps.tag.outputs.name }}
draft: true
generate_release_notes: true
files: artifacts/*
fail_on_unmatched_files: true