Repository navigation
102 lines (95 loc) · 2.8 KB
/
Copy pathpython-publish.yml
File metadata and controls
102 lines (95 loc) · 2.8 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
name: Publish
on:
workflow_dispatch:
inputs:
release_pypi:
description: 'Publish to PyPI'
type: boolean
default: true
release_github:
description: 'Build and release Windows executables'
type: boolean
default: false
release_gui:
description: 'Include Windows GUI executable (requires GooeyEx)'
type: boolean
default: false
permissions:
contents: read
env:
PYTHONUTF8: '1'
concurrency:
group: publish
cancel-in-progress: false
jobs:
build:
if: inputs.release_pypi || inputs.release_github
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install build and test dependencies
run: python -m pip install build twine pytest
- name: Build distributions
run: python -m build
- name: Check distributions
run: python -m twine check --strict dist/*
- name: Install wheel
shell: pwsh
run: python -m pip install (Get-Item dist/*.whl).FullName
- name: Test
run: python -m pytest -v
- name: Check installed command
working-directory: ${{ runner.temp }}
run: sssekai --help
- uses: actions/upload-artifact@v4
with:
name: python-distributions
path: dist/
if-no-files-found: error
publish-pypi:
if: inputs.release_pypi
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/sssekai/
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: python-distributions
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
release-windows:
if: inputs.release_github
needs: build
runs-on: windows-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: python -m pip install pyinstaller ".[il2cpp]"
- name: Install GUI dependencies
if: inputs.release_gui
run: python -m pip install ".[gui]"
- name: Build Windows executables
run: pyinstaller sssekai.spec
- name: Build Windows GUI executable
if: inputs.release_gui
run: pyinstaller sssekai-gui.spec
- name: Create GitHub release
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
run: |
$version = python -c "import sssekai; print(sssekai.__version__)"
gh release create $version (Get-Item dist/*.exe).FullName --target "${{ github.sha }}" --title "Version $version" --generate-notes