Skip to content

Clean up and fix of pipeline #6

Clean up and fix of pipeline

Clean up and fix of pipeline #6

Workflow file for this run

---
name: Test And Publish
on:
push:
tags:
- "v*.*.*"
jobs:
test:
uses: atropos112/template-python-pkg/.github/workflows/devenv_test.yaml@main
if: github.repository != 'atropos112/template-python-pkg'
secrets: inherit
publish:
runs-on: ubuntu-latest
if: github.repository != 'atropos112/template-python-pkg'
needs: test
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install poetry
uses: abatilo/actions-poetry@v3
- name: Setup a local virtual environment (if no poetry.toml file)
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
- uses: actions/cache@v4
name: Define a cache for the virtual environment based on the dependencies lock file
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Install the project dependencies
run: poetry install
- name: Set Poetry Version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
poetry version $VERSION
- name: Publish
run: poetry publish --build
- name: Commit updated pyproject.toml
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add pyproject.toml
git commit -m "Update pyproject.toml version to $VERSION"
- name: Push changes
run: |
git config pull.rebase true
git pull origin main
git push origin HEAD:main