diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index fe6790d2d..75bd1c377 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -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 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 226220d4e..16ccd21e6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index fc9b7b00f..c7c64f86b 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -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: @@ -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 @@ -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/ @@ -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: @@ -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: