-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
misc(ci): Added GitHub Actions workflow to build and publish packages…
… on PyPI
- Loading branch information
Showing
1 changed file
with
65 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,65 @@ | ||
name: "Build and Publish Python Packages" | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v[0-9]+\\.[0-9]+\\.[0-9]+" | ||
- "v[0-9]+\\.[0-9]+\\.[0-9]+-[0-9]+" | ||
|
||
jobs: | ||
|
||
build_sdist_wheel: | ||
|
||
name: "Source and wheel distribution" | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- name: "Checkout the repository" | ||
uses: actions/checkout@v4 | ||
|
||
- name: "Set up Python" | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.12" | ||
|
||
- name: "Install Python build dependencies" | ||
run: | | ||
pip install setuptools wheel nox | ||
- name: "Build source distribution" | ||
run: | | ||
python setup.py sdist | ||
- name: "Build wheel" | ||
run: | | ||
python setup.py bdist_wheel | ||
- name: "Upload artifacts" | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: rivalcfg-dist | ||
path: dist/ | ||
retention-days: 1 | ||
|
||
publish_pypi: | ||
|
||
name: "Publish packages on PyPI" | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build_sdist_wheel | ||
|
||
steps: | ||
|
||
- name: "Download artifacts" | ||
uses: actions/download-artifact@v4 | ||
|
||
- name: "Move packages to the dist/ folder" | ||
run: | | ||
mkdir dist/ | ||
mv rivalcfg-dist/* dist/ | ||
- name: "Publish packages on PyPI" | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} |