-
Notifications
You must be signed in to change notification settings - Fork 6
144 lines (129 loc) · 5.05 KB
/
Copy pathrelease.yml
File metadata and controls
144 lines (129 loc) · 5.05 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
#
# This runs when version tag is pushed
#
name: REL
on:
push:
tags: ["v[0-9]*"]
jobs:
sdist:
name: "Build source package"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: "3.14"
pip-install: -r etc/requirements.build.txt
- run: python3 setup.py sdist
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with: {name: "sdist", path: "dist"}
cibuildwheel:
name: "Wheels: ${{matrix.sys.name}} [${{matrix.sys.archs}}]"
runs-on: ${{matrix.sys.os}}
strategy:
matrix:
sys:
- {os: "ubuntu-latest", name: "Linux", archs: "auto"}
- {os: "ubuntu-24.04-arm", name: "Linux", archs: "aarch64"}
- {os: "macos-15-intel", name: "MacOS", archs: "x86_64 universal2"}
- {os: "macos-latest", name: "MacOS", archs: "auto"}
- {os: "windows-latest", name: "Windows", archs: "auto"}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: pypa/cibuildwheel@4726cd35bb13f7bde50cf2761f2499ac7b3aa32c # v4.1.1
env:
CIBW_ARCHS: "${{matrix.sys.archs}}"
- name: "Check"
shell: bash
run: |
ls -l wheelhouse
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with: {name: "wheel-${{matrix.sys.os}}", path: "wheelhouse"}
dist:
name: "Collect files"
runs-on: ubuntu-latest
needs: [sdist, cibuildwheel]
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with: { path: "dist", merge-multiple: true }
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with: {name: "dist", path: "dist"}
publish-github:
name: "Publish to Github"
runs-on: ubuntu-latest
needs: [dist]
permissions:
contents: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: "3.14"
pip-install: -r etc/requirements.build.txt
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with: {name: "dist", path: "dist"}
- name: "Install pandoc"
run: |
sudo -nH apt-get -u -y install pandoc
pandoc --version
- name: "Prepare"
run: |
ls -l dist
PACKAGE=$(python3 setup.py --name)
VERSION=$(python3 setup.py --version)
TGZ="${PACKAGE}-${VERSION}.tar.gz"
# default - gh:release, pypi
# PRERELEASE - gh:prerelease, pypi
# DRAFT - gh:draft,prerelease, testpypi
PRERELEASE="false"; DRAFT="false"
case "${VERSION}" in
*[ab]*|*rc*) PRERELEASE="true";;
*dev*) PRERELEASE="true"; DRAFT="true";;
esac
test "${{github.ref}}" = "refs/tags/v${VERSION}" || { echo "ERR: tag mismatch"; exit 1; }
test -f "dist/${TGZ}" || { echo "ERR: sdist failed [dist/${TGZ}]"; ls -l dist; exit 1; }
echo "PACKAGE=${PACKAGE}" >> $GITHUB_ENV
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "TGZ=${TGZ}" >> $GITHUB_ENV
echo "PRERELEASE=${PRERELEASE}" >> $GITHUB_ENV
echo "DRAFT=${DRAFT}" >> $GITHUB_ENV
mkdir -p tmp
make -s shownote > tmp/note.md
cat tmp/note.md
ls -l dist
- name: "Create Github release"
env:
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
title="${PACKAGE} v${VERSION}"
ghf="--notes-file=./tmp/note.md"
if test "${DRAFT}" = "true"; then ghf="${ghf} --draft"; fi
if test "${PRERELEASE}" = "true"; then ghf="${ghf} --prerelease"; fi
#gh release create "v${VERSION}" --title="${title}" ${ghf} dist/*
gh release create "v${VERSION}" --title="${title}" ${ghf} dist/${TGZ}
publish-pypi:
if: ${{ !contains(github.ref_name, '.dev') }}
name: "Publish to PyPi"
runs-on: ubuntu-latest
needs: [dist]
permissions:
id-token: write
environment: pypi
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with: { name: "dist", path: "dist" }
- uses: pypa/gh-action-pypi-publish@ba38be9e461d3875417946c167d0b5f3d385a247 # v1.14.1
publish-testpypi:
if: ${{ contains(github.ref_name, '.dev') }}
name: "Publish to TestPyPi"
runs-on: ubuntu-latest
needs: [dist]
permissions:
id-token: write
environment: testpypi
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with: { name: "dist", path: "dist" }
- uses: pypa/gh-action-pypi-publish@ba38be9e461d3875417946c167d0b5f3d385a247 # v1.14.1
with: { repository-url: "https://test.pypi.org/legacy/" }