-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
78b95fc
commit b30b6ab
Showing
1 changed file
with
79 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: Release | ||
on: | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build_dist_files: | ||
# Build source distribution and wheel if package is pure python | ||
name: Build distribution files | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Install build tool | ||
run: python -m pip install build | ||
|
||
- name: Build sdist | ||
run: python -m build --sdist . | ||
|
||
- name: Build wheel | ||
run: | | ||
python -m pip install -r doc/requirements-rtd.txt | ||
cd doc && make html && cd .. | ||
python -m build --wheel . | ||
- name: Upload dist files | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: dist-sdist | ||
path: dist/* | ||
|
||
upload_release_assets: | ||
name: Upload Release Assets | ||
needs: [build_dist_files, build_wheels] | ||
# run eventhough job in need is skipped | ||
if: always() && !failure() && !cancelled() && startsWith(github.ref, 'refs/tags') | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
# unpacks all dist artifacts into dist/ | ||
pattern: dist-* | ||
path: dist | ||
merge-multiple: true | ||
|
||
- name: Upload to release | ||
uses: shogo82148/actions-upload-release-asset@v1 | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: dist/*.whl | ||
|
||
pypi_publish: | ||
name: PyPI Publish | ||
needs: [build_dist_files, build_wheels] | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write # this permission is mandatory for trusted publishing | ||
# run eventhough job in need is skipped | ||
if: always() && !failure() && !cancelled() && startsWith(github.ref, 'refs/tags') | ||
|
||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
# unpacks all dist artifacts into dist/ | ||
pattern: dist-* | ||
path: dist | ||
merge-multiple: true | ||
|
||
- name: Publish packages to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
packages_dir: dist/ |