Skip to content

Commit

Permalink
Add CI workflow to release to pypi
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertoBochet committed Jun 27, 2024
1 parent 19151cb commit fe825f2
Showing 1 changed file with 35 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
name: build-container
name: release

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
build-container:
publish-container-image:
name: "Publish container image to github registry"
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -44,3 +45,35 @@ jobs:
for TAG in ${TAGS}; do
docker push ghcr.io/${GITHUB_REPOSITORY,,}:${TAG}
done
publish-python-package:
name: "Publish python package to pypi"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Get version
run: |
VERSION="${GITHUB_REF/refs\/tags\//}"
VERSION="${VERSION/v/}"
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Set version
run: |
sed -i "s|^version[\ ]*=.*|version = \"${VERSION}\"|g" pyproject.toml
- name: Setup Python
uses: actions/setup-python@v5.1.0
with:
python-version: "3.12"
- name: Install Poetry Action
uses: snok/install-poetry@v1.3.4
with:
version: '1.8.3'
- name: Build package
run: |
poetry build
- name: Setup Pypi
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
- name: Publish to Pypi
run: |
poetry publish

0 comments on commit fe825f2

Please sign in to comment.