Skip to content

Commit

Permalink
automate pypi releases (#4)
Browse files Browse the repository at this point in the history
* automate pypi releases

* auto update the project version to match the release tag

* revert release update test

* use trusted publisher workflow

* Update .github/workflows/publish-release.yml

Co-authored-by: Eric G. Kratz <[email protected]>

* Update .github/workflows/publish-release.yml

Co-authored-by: Eric G. Kratz <[email protected]>

---------

Co-authored-by: Eric G. Kratz <[email protected]>
  • Loading branch information
valentinsulzer and kratman authored Sep 23, 2024
1 parent 25ea902 commit 07ca17c
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Publish to PyPI

on:
release:
types: [published]


concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Release:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
permissions:
id-token: write

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Update version
run: |
export RELEASE_VERSION=$(echo ${{ github.ref_name }} | sed -e 's/v//g')
sed -i "s/version = .*/version = \"$RELEASE_VERSION\"/" pyproject.toml
- name: Build wheel
run: |
pip wheel . --no-deps -w deploy
- name: Upload package
uses: actions/upload-artifact@v2
with:
name: wheels
path: deploy/
if-no-files-found: error

- name: Publish on PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: deploy/

0 comments on commit 07ca17c

Please sign in to comment.