v3.7.3 #11
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: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
id: checkout | |
uses: actions/checkout@v3 | |
- name: "Setup Python" | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Build tarball | |
id: build | |
run: | | |
python -m pip install --disable-pip-version-check -U setuptools wheel | |
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" | |
if echo "${VERSION}" | grep -qE '(a|b|rc)'; then PRERELEASE="true"; fi | |
if echo "${VERSION}" | grep -qE '(dev)'; then DRAFT="true"; PRERELEASE="true"; fi | |
test "${{github.ref}}" = "refs/tags/v${VERSION}" || { echo "ERR: tag mismatch"; exit 1; } | |
python setup.py sdist | |
test -f "dist/${TGZ}" || { echo "ERR: sdist failed"; exit 1; } | |
python -m pip wheel --disable-pip-version-check -w dist dist/${TGZ} | |
rm -f dist/skytools* | |
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 | |
- name: "Create release" | |
id: github_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
with: | |
tag_name: ${{github.ref}} | |
release_name: ${{env.PACKAGE}} v${{env.VERSION}} | |
body_path: tmp/note.md | |
prerelease: ${{env.PRERELEASE}} | |
draft: ${{env.DRAFT}} | |
- name: "Upload to Github" | |
id: github_upload | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
with: | |
upload_url: ${{steps.github_release.outputs.upload_url}} | |
asset_path: dist/${{env.TGZ}} | |
asset_name: ${{env.TGZ}} | |
asset_content_type: application/x-gzip | |
- 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 | |