Skip to content

Run test publish workflow on push to release/ branches #51

Run test publish workflow on push to release/ branches

Run test publish workflow on push to release/ branches #51

Workflow file for this run

---
name: Publish on Test PyPI and PyPI
on:
pull_request:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install pypa/build
run: python -m pip install build
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
- name: Upload distribution artifact
uses: actions/upload-artifact@v4
with:
name: release
path: dist/
publish-test:
name: Build and publish on TestPyPI
if: github.repository_owner == 'aiidalab'
needs: [build]
runs-on: ubuntu-latest
environment:
name: Test PyPI
url: https://test.pypi.org/project/aiidalab-widgets-base/
steps:
- uses: actions/download-artifact@v4
name: Download distribution artifact
with:
name: release
path: dist/
- name: Publish distribution on Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
skip-existing: true
publish:
name: Build and publish on PyPI
if: startsWith(github.ref, 'refs/tags/v') && github.repository_owner == 'aiidalab'
needs: [build, publish-test]
runs-on: ubuntu-latest
environment:
name: PyPI
url: https://pypi.org/project/aiidalab-widgets-base/
steps:
- uses: actions/download-artifact@v4
name: Download distribution artifact
with:
name: release
path: dist/
- name: Publish distribution on PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}