v3.9.1dev0 #38
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# https://docs.github.com/en/actions/reference | |
# https://github.com/actions | |
# | |
name: REL | |
on: | |
push: | |
tags: ["v[0-9]*"] | |
jobs: | |
sdist: | |
name: "Build source package" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: {python-version: "3.11"} | |
- run: python setup.py sdist | |
- uses: actions/upload-artifact@v3 | |
with: {name: "dist", path: "dist"} | |
cibuildwheel: | |
name: "Wheels: ${{matrix.sys.name}}" | |
runs-on: ${{matrix.sys.os}} | |
strategy: | |
matrix: | |
sys: | |
- {os: "ubuntu-latest", name: "Linux", arches: "auto"} | |
- {os: "macos-latest", name: "MacOS", arches: "x86_64 arm64 universal2"} | |
- {os: "windows-latest", name: "Windows", arches: "auto"} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pypa/[email protected] | |
env: | |
CIBW_ARCHS: ${{matrix.sys.arches}} | |
- name: "Check" | |
shell: bash | |
run: | | |
ls -l | |
ls -l wheelhouse | |
- uses: actions/upload-artifact@v3 | |
with: {name: "dist", path: "wheelhouse"} | |
publish: | |
name: "Publish" | |
runs-on: ubuntu-latest | |
needs: [sdist, cibuildwheel] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: {python-version: "3.11"} | |
- uses: actions/download-artifact@v3 | |
with: {name: "dist", path: "dist"} | |
- name: "Prepare" | |
run: | | |
PACKAGE=$(python setup.py --name) | |
VERSION=$(python 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"; 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 | |
sudo -nH apt-get -u -y install pandoc | |
pandoc --version | |
mkdir -p tmp | |
make -s shownote > tmp/note.md | |
cat tmp/note.md | |
ls -l dist | |
- name: "Create Github release" | |
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}" "dist/${TGZ}" --title="${title}" ${ghf} | |
- name: "Upload to PYPI" | |
id: pypi_upload | |
env: | |
PYPI_TOKEN: ${{secrets.PYPI_TOKEN}} | |
PYPI_TEST_TOKEN: ${{secrets.PYPI_TEST_TOKEN}} | |
run: | | |
pip install --disable-pip-version-check -U twine | |
ls -l dist | |
if test "${DRAFT}" = "false"; then | |
python -m twine upload -u __token__ -p ${PYPI_TOKEN} \ | |
--repository pypi --disable-progress-bar dist/* | |
else | |
python -m twine upload -u __token__ -p ${PYPI_TEST_TOKEN} \ | |
--repository testpypi --disable-progress-bar dist/* | |
fi | |