-
Notifications
You must be signed in to change notification settings - Fork 11
42 lines (40 loc) · 1.21 KB
/
publishing.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
38
39
40
41
42
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
on:
push:
branches:
- harmslab/master
paths:
- '**__version__.py'
jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Verify that the package installs from source.
run: |
pip install .
- name: Publish distribution 📦 to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.GH_actions_PyPI_token }}
run: |
python setup.py sdist
twine upload dist/*
- name: Tag this version
run: |
VERSION=$(python -c 'mod = "${{ github.repository }}".split("/")[-1]; version = __import__(mod).__version__; print("v" + version);')
git tag $VERSION
- name: Push tags
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tags: true