-
Notifications
You must be signed in to change notification settings - Fork 5
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 #3 from mandy2666/master
Add GitHub Actions workflow for Poetry publishing
- Loading branch information
Showing
1 changed file
with
46 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,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 | ||
|