-
Notifications
You must be signed in to change notification settings - Fork 7
40 lines (39 loc) · 1.29 KB
/
release.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
name: Release
on: push
jobs:
test:
name: Deploy release to PyPI
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
- name: Get the version
id: get_version
run: echo ::set-env name=GHA_TAG_VERSION::${GITHUB_REF#refs/tags/}
- name: Get the SHA1 of the git commit
id: get_hash
run: echo ::set-env name=GHA_GIT_COMMIT::${GITHUB_SHA}
- name: Build package
run: |
python setup.py sdist
python setup.py bdist_wheel --universal
- name: Publish package to test PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_TEST }}
repository_url: https://test.pypi.org/legacy/
- name: Publish package to main PyPI
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_MASTER }}