Publish Releases: PyPi / GitHub #11
Workflow file for this run
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
name: "Publish Releases: PyPi / GitHub" | |
on: | |
push: | |
tags: | |
- '*.*.*' | |
workflow_dispatch: | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_AUTH_TOKEN }} | |
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
jobs: | |
build-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout Repo | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Setup Python | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' | |
# Install Poetry | |
- name: Install Poetry | |
run: | | |
python -m pip install pipx | |
pipx ensurepath | |
pipx install poetry | |
# Cache Poetry | |
- name: Setup Poetry Cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pypoetry/virtualenvs | |
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-poetry- | |
# Install dependencies | |
- name: Install Deps | |
run: poetry install --with dev | |
# Publish to PyPi | |
#- name: Publish to PyPI | |
# run: | | |
# poetry config pypi-token.pypi $PYPI_TOKEN | |
# poetry publish --build | |
# Get Version Tag | |
- name: Generate Changes | |
id: latest_version | |
run: | | |
echo "VERSION_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
# Generate GitHub Release | |
- name: Create Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ env.VERSION_TAG }} |