-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Modernized release workflow * rename action * Update whats-new.rst
- Loading branch information
Showing
2 changed files
with
23 additions
and
73 deletions.
There are no files selected for viewing
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
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 | ||
|
@@ -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/* |
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