-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #100 from felix-seifert/release-on-pypi
ci: add workflow to automatically release to PyPI and GitHub
- Loading branch information
Showing
1 changed file
with
55 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,55 @@ | ||
name: Release to PyPI and GitHub | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' # Push events with tags 'v*', i.e. 'v1.0.4' or 'v0.3.2' | ||
|
||
jobs: | ||
deploy-with-twine: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: | | ||
.github | ||
src | ||
pyproject.toml | ||
requirements.txt | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.10 | ||
cache: "pip" | ||
|
||
- name: Install dependencies (with Twine) | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
pip install twine | ||
- name: Build dist | ||
run: | | ||
python -m build | ||
- name: Test dist | ||
run: | | ||
python -m twine check dist/* | ||
- name: Deploy dist | ||
run: | | ||
python -m twine upload dist/* | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
|
||
release-on-github: | ||
needs: deploy-with-twine | ||
name: Trigger GitHub release workflow | ||
uses: ./.github/workflows/release-on-github.yaml | ||
with: | ||
tag: ${{ github.ref_name }} |