-
-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (123 loc) · 3.74 KB
/
Copy pathBuild-Release-PYPI.yml
File metadata and controls
136 lines (123 loc) · 3.74 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
name: "Build-Release-PYPI"
on:
pull_request:
branches:
- main
push:
branches:
- main
permissions:
contents: write
id-token: write
jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.14'
- name: Create virtual environment
run: |
python -m venv venv
- name: Install dependencies in virtual environment
run: |
.\venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install --upgrade wheel
python -m pip install --upgrade pyinstaller
python -m pip install --upgrade -r requirements.txt
shell: pwsh
- name: Generate version info file
run: |
.\venv\Scripts\Activate.ps1
python scripts/generate_file_version_info.py
shell: pwsh
- name: Build executable
run: |
.\venv\Scripts\Activate.ps1
pyinstaller PyRefactor.spec
shell: pwsh
- name: Rename executable
run: |
Rename-Item -Path dist/PyRefactor.exe -NewName PyRefactor-v1.0.${{ github.run_number }}.exe
shell: pwsh
- name: Zip the exe
run: |
Compress-Archive -Path "dist/PyRefactor-v1.0.${{ github.run_number }}.exe" -DestinationPath "dist/PyRefactor-v1.0.${{ github.run_number }}.zip"
shell: pwsh
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: windows-build
path: dist/PyRefactor-v1.0.${{ github.run_number }}.zip
build-wheels:
name: Build Python wheels
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.14'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install --upgrade wheel
python -m pip install --upgrade build
- name: Build pure Python wheel and sdist
run: |
python -m build
- name: Store artifacts
uses: actions/upload-artifact@v7
with:
name: python-dist
path: dist/
create-release:
needs: [build-windows]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Download Windows build
uses: actions/download-artifact@v8
with:
name: windows-build
path: ./build
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
artifacts: ./build/PyRefactor-v1.0.${{ github.run_number }}.zip
tag: v1.0.${{ github.run_number }}
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
removeArtifacts: true
publish-pypi:
name: Publish wheels to PyPI
needs: build-wheels
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v8
with:
name: python-dist
path: dist
- name: Setup python
uses: actions/setup-python@v6
with:
python-version: '3.14'
- name: Install Twine
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install --upgrade wheel
python -m pip install --upgrade twine
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PYREFACTOR }}
run: |
twine check dist/*
twine upload dist/*