Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernized release workflow #361

Merged
merged 5 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/gh-action-pypi-publish@v1.8.14
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/gh-action-pypi-publish@v1.8.14
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
Loading