Skip to content

day 04

day 04 #192

Workflow file for this run

name: Publish to PyPI
on:
push:
branches: ["main"]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.12"
architecture: x64
cache: pip
cache-dependency-path: pyproject.toml
- name: Create release
run: |
python -VV
python -m pip install -q -U wheel setuptools twine luddite build
python -m build -n -x -C=--global-option=-q
- uses: jannekem/run-python-script-action@v1
with:
script: |
import sys
sys.path.append(".")
import aoc_wim, luddite, subprocess
v = aoc_wim.__version__
vs = luddite.get_versions_pypi("advent-of-code-wim")
if v in vs:
print(f"{v} already exists")
sys.exit(0)
cmd = "twine upload --disable-progress-bar -u __token__ -p ${{secrets.PYPI_TOKEN}} dist/*"
subprocess.check_call(cmd.split())
subprocess.check_call(["git", "tag", v])
subprocess.check_call(["git", "push", "--tags"])