-
Notifications
You must be signed in to change notification settings - Fork 10
37 lines (35 loc) · 1.16 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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.11"
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"])