Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add workflow to automatically release to PyPI and GitHub #100

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/release.yaml
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 }}