-
-
Notifications
You must be signed in to change notification settings - Fork 45
166 lines (146 loc) · 4.54 KB
/
release.yaml
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
name: Release
on:
release:
types: [released]
concurrency:
group: release
cancel-in-progress: false
jobs:
package_python3:
name: Create sdist and Python 3 Wheel
runs-on: ubuntu-latest
outputs:
sdist: ${{ steps.package.outputs.sdist }}
wheel: ${{ steps.package.outputs.wheel }}
container:
image: danielflook/python-minifier-build:python3.13-2024-09-15
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 1
show-progress: false
persist-credentials: false
- name: Set version statically
env:
VERSION: ${{ github.event.release.tag_name }}
run: |
sed -i "s/setup_requires=.*/version='$VERSION',/; s/use_scm_version=.*//" setup.py
echo "Version: $VERSION"
- name: Build distribution packages
id: package
run: |
pip3 install --upgrade build
python3 -m build
echo "sdist=$(find dist -name '*.tar.gz' -printf "%f\n")" >> "$GITHUB_OUTPUT"
echo "wheel=$(find dist -name '*-py3-*.whl' -printf "%f\n")" >> "$GITHUB_OUTPUT"
- name: Upload sdist artifact
uses: actions/[email protected]
with:
name: dist-sdist
path: dist/${{ steps.package.outputs.sdist }}
if-no-files-found: error
- name: Upload Python 3 wheel artifact
uses: actions/[email protected]
with:
name: dist-py3-wheel
path: dist/${{ steps.package.outputs.wheel }}
if-no-files-found: error
package_python2:
name: Create Python 2 Wheel
runs-on: ubuntu-latest
needs: [package_python3]
outputs:
wheel: ${{ steps.package.outputs.wheel }}
container:
image: danielflook/python-minifier-build:python2.7-2024-09-15
steps:
- name: Download source distribution artifact
uses: actions/[email protected]
with:
name: dist-sdist
path: dist/
- name: Build Python 2 wheel
id: package
env:
PYTHON3_SDIST: ${{ needs.package_python3.outputs.sdist }}
run: |
dnf install -y findutils
pip install --upgrade wheel
pip wheel dist/"$PYTHON3_SDIST" -w dist
echo "wheel=$(find dist -name '*-py2-*.whl' -printf "%f\n")" >> "$GITHUB_OUTPUT"
- name: Upload Python 2 wheel artifact
uses: actions/[email protected]
with:
name: dist-py2-wheel
path: dist/${{ steps.package.outputs.wheel }}
if-no-files-found: error
documentation:
name: Test Documentation
runs-on: ubuntu-latest
needs: [package_python3]
container:
image: danielflook/python-minifier-build:python3.13-2024-09-15
steps:
- uses: actions/[email protected]
with:
name: dist-sdist
path: dist/
- name: Install package
env:
PYTHON3_SDIST: ${{ needs.package_python3.outputs.sdist }}
run: |
pip3 install dist/"$PYTHON3_SDIST"
pyminify --version
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 1
show-progress: false
persist-credentials: false
- name: Build documentation
run: |
pip3 install sphinx sphinxcontrib-programoutput sphinx_rtd_theme
sphinx-build docs/source /tmp/build
- name: Upload documentation artifact
uses: actions/[email protected]
with:
path: /tmp/build
publish-to-pypi:
name: Publish to PyPI
needs:
- package_python3
- package_python2
runs-on: ubuntu-latest
permissions:
id-token: write
environment:
name: pypi
url: https://pypi.org/project/python-minifier/${{ github.event.release.tag_name }}
steps:
- name: Download distribution artifacts
uses: actions/[email protected]
with:
pattern: dist-*
path: dist/
merge-multiple: true
- name: Publish package distributions to PyPI
uses: pypa/[email protected]
with:
print-hash: true
verbose: true
publish-docs:
name: Publish Documentation
needs:
- documentation
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/[email protected]