Skip to content

Commit

Permalink
Merge pull request #3 from mandy2666/master
Browse files Browse the repository at this point in the history
Add GitHub Actions workflow for Poetry publishing
  • Loading branch information
cobycloud authored Oct 21, 2024
2 parents 66d1602 + f5da629 commit 90dea11
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build and Publish

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install Poetry
run: curl -sSL https://install.python-poetry.org | python3 -

- name: Configure Poetry to add to PATH
run: echo "${{ runner.tool_cache }}/poetry/$(poetry --version | awk '{print $3}')/bin" >> $GITHUB_PATH

- name: Install dependencies
run: |
cd pkg
poetry install
- name: Run tests
run: poetry run pytest -v . --junitxml=results.xml

- name: Build the package
run: poetry build

- name: Publish to PyPI
if: github.ref == 'refs/heads/master'
env:
POETRY_PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
POETRY_PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: poetry publish --build --username $POETRY_PYPI_USERNAME --password $POETRY_PYPI_API_TOKEN

0 comments on commit 90dea11

Please sign in to comment.