-
Notifications
You must be signed in to change notification settings - Fork 1
34 lines (32 loc) · 1.03 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
name: Publish to PyPI.org
on:
release:
types: [ published ]
workflow_dispatch:
permissions:
id-token: write
jobs:
pypi:
runs-on: ubuntu-latest
environment: Deploy
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade setuptools wheel
python3 -m pip install --upgrade build
python3 -m pip install --upgrade twine
# setup.py expects the environment variable VERSION to be set
- name: Build and publish
run: |
export VERSION=$(gh release view --jq '.tagName' --json tagName)
echo "VERSION: $VERSION"
python3 -m build
python3 -m twine check dist/*
python3 -m twine upload --repository pypi dist/* --username __token__ --password ${{ secrets.PYPI_API_TOKEN }}