ci: bump upload/download artifact v4
[1/2]
#412
Workflow file for this run
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
name: PyPI Release | |
# https://help.github.com/en/actions/reference/events-that-trigger-workflows | |
on: # Trigger the workflow on push or pull request, but only for the master branch | |
push: | |
branches: [main, "release/*"] | |
tags: ["v?[0-9]+.[0-9]+.[0-9]+"] | |
release: | |
types: [published] | |
pull_request: | |
branches: [main] | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
# based on https://github.com/pypa/gh-action-pypi-publish | |
build-package: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Set up Python 🐍 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: Prepare build env. | |
run: pip install -r ./requirements/gha-package.txt | |
- name: Create 📦 package | |
uses: ./.github/actions/pkg-create | |
- name: Upload 📤 packages | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pypi-packages-${{ github.sha }} | |
path: dist | |
upload-package: | |
needs: build-package | |
if: github.event_name == 'release' | |
timeout-minutes: 5 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
- name: Download 📥 artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: pypi-packages-${{ github.sha }} | |
path: dist | |
- name: local 🗃️ files | |
run: ls -lh dist/ | |
- name: Upload to release | |
uses: AButler/[email protected] | |
with: | |
files: "dist/*" | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
publish-package: | |
needs: build-package | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Download 📥 artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: pypi-packages-${{ github.sha }} | |
path: dist | |
- name: local 🗃️ files | |
run: ls -lh dist/ | |
# We do this, since failures on test.pypi aren't that bad | |
- name: Publish to Test PyPI | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.test_pypi_password }} | |
repository-url: https://test.pypi.org/legacy/ | |
verbose: true | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_password }} |