Skip to content
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
4 changes: 4 additions & 0 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
pull_request:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-docs:
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
pull_request:
branches: [main, devel]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
get-versions:
runs-on: ubuntu-latest
Expand Down
81 changes: 38 additions & 43 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,9 @@ concurrency:
cancel-in-progress: false

jobs:
publish-pypi-test:
name: Publish to TestPyPI
environment:
name: test
url: https://test.pypi.org/project/ultraplot/
build-packages:
name: Build packages
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -38,7 +32,7 @@ jobs:
python -m pip install --upgrade pip wheel setuptools setuptools_scm build twine
python -m build --sdist --wheel . --outdir dist

- name: CheckFiles
- name: Check files
run: |
ls dist
shell: bash
Expand All @@ -59,8 +53,37 @@ jobs:
popd
shell: bash

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist-${{ github.sha }}-${{ github.run_id }}-${{ github.run_number }}
path: dist/*
if-no-files-found: error

publish-pypi-test:
name: Publish to TestPyPI
needs: build-packages
if: github.event_name != 'pull_request'
environment:
name: test
url: https://test.pypi.org/project/ultraplot/
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: dist-${{ github.sha }}-${{ github.run_id }}-${{ github.run_number }}
path: dist

- name: Check files
run: |
ls dist
shell: bash

- name: Publish to TestPyPI
if: github.event_name != 'pull_request'
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
Expand All @@ -69,7 +92,7 @@ jobs:
# we get a race condition if we don't skip existing
skip-existing: ${{ github.event_name == 'release' && 'true' || 'false' }}

publish-prod:
publish-pypi:
name: Publish to PyPI
needs: publish-pypi-test
environment:
Expand All @@ -81,44 +104,16 @@ jobs:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
fetch-depth: 0
name: dist-${{ github.sha }}-${{ github.run_id }}-${{ github.run_number }}

- name: Get tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
shell: bash

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Build package
run: |
python -m pip install --upgrade pip wheel setuptools setuptools_scm build twine
python -m build --sdist --wheel . --outdir dist

- name: CheckFiles
- name: Check files
run: |
ls dist
shell: bash

- name: Test wheels
run: |
pushd dist
python -m pip install ultraplot*.whl

version=$(python -c "import ultraplot; print(ultraplot.__version__)")
echo "Version: $version"
if [[ "$version" == "0."* ]]; then
echo "Version is not set correctly!"
exit 1
fi

python -m twine check *
popd
shell: bash

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down