-
Notifications
You must be signed in to change notification settings - Fork 35
42 lines (40 loc) · 1.63 KB
/
publish-to-pypi.yaml
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
38
39
40
41
42
name: Deploy to PyPI
on: push
jobs:
build-n-publish:
name: Deploy
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@master
# https://github.com/ansible/pylibssh/blob/1e7b17f/.github/workflows/build-test-n-publish.yml#L146-L151
- name: Get history and tags for SCM versioning to work
run: |
git fetch --prune --unshallow
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
git describe --tags
git describe --tags $(git rev-list --tags --max-count=1)
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install pep517
run: |
python -m pip install pep517 --user
python -m pip install setuptools_scm
python setup.py --version
- name: Create setuptools_scm env variable
if: startsWith(github.ref, 'refs/tags/') != true
shell: bash
run: |
wget https://gist.github.com/plaplant/0902f09e59166bac742bbd554f3cd2f9/raw/make_dev_version.sh -O ../make_dev_version.sh
version=$(bash ../make_dev_version.sh)
echo "SETUPTOOLS_SCM_PRETEND_VERSION=$version" >> $GITHUB_ENV
- name: Build a binary wheel and a source tarball
run: python -m pep517.build --binary --source --out-dir dist .
# deploy to actual PyPI only when a tag is pushed (which should happen only
# automatically on master)
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.pypi_password }}