Skip to content

Commit

Permalink
Modernized release workflow (#361)
Browse files Browse the repository at this point in the history
* Modernized release workflow

* rename action

* Update whats-new.rst
  • Loading branch information
jbusecke authored Jun 25, 2024
1 parent 5ef581f commit f1773fe
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 73 deletions.
95 changes: 22 additions & 73 deletions .github/workflows/pythonpublish.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: Build and Upload xmip to PyPI
on:
push:
branches:
- "main"
pull_request:
branches:
- "*"
release:
types:
- published
Expand All @@ -12,82 +18,25 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
name: Install Python
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install setuptools setuptools-scm[toml] wheel twine
- name: Check python version
python -m pip install --upgrade setuptools setuptools-scm build twine
- name: Build only
if: github.event_name != 'release'
run: |
python --version
- name: Check current package version
python -m build
twine check dist/*
- name: Build and publish
if: github.event_name == 'release'
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python setup.py --version
- name: Build tarball and wheels
run: |
git clean -xdf
git restore -SW .
python setup.py sdist bdist_wheel
- name: Check built artifacts
run: |
python -m twine check dist/*
pwd
if [ -f dist/xmip-0.0.0.tar.gz ]; then
echo "❌ INVALID VERSION NUMBER"
exit 1
else
echo "✅ Looks good"
fi
- uses: actions/upload-artifact@v4
with:
name: releases
path: dist
test-built-dist:
needs: build-artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: 3.8
- uses: actions/download-artifact@v4
with:
name: releases
path: dist
- name: List contents of built dist
run: |
ls -ltrh
ls -ltrh dist
upload-to-testpypi:
needs: test-built-dist
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: releases
path: dist
- name: Publish package to TestPyPI
uses: pypa/[email protected]
with:
user: __token__
repository_url: https://test.pypi.org/legacy/
password: ${{ secrets.TESTPYPI_TOKEN }}
verbose: true
upload-to-pypi:
needs: upload-to-testpypi
if: "!github.event.release.prerelease"
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: releases
path: dist
- name: Publish package to PyPI
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
verbose: true
python -m build
twine check dist/*
twine upload dist/*
1 change: 1 addition & 0 deletions docs/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Internal Changes
~~~~~~~~~~~~~~~~
- Add `longitude_bnds` and `latitude_bnds` to `cmip_renaming_dict` (:pull:`300`). By `Joran Angevaare <https://github.com/JoranAngevaare>`
- Updated pre-commit linting to use ruff (:pull:`359`). By `Julius Busecke <https://github.com/jbusecke>`
- Modernized packaging workflow, that runs on each PR (:pull:`361`). By `Julius Busecke <https://github.com/jbusecke>`
- Added 'nvertices' -> 'vertex' to renaming preprocessor (:pull:`357`). By `Julius Busecke <https://github.com/jbusecke>`

.. _whats-new.0.7.2:
Expand Down

0 comments on commit f1773fe

Please sign in to comment.