Skip to content

Commit

Permalink
fix: make publishing to true pypi happen only on tag push
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-murray committed May 21, 2020
1 parent de601fe commit 431136a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/bump_version.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name: Bump version
name: Bump Version and Deploy
on:
push:
branches:
- master
jobs:
build:
bump-version-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Bump version and push tag
uses: mathieudutour/github-tag-action@v4.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
github_token: ${{ secrets.bump_version }}
default_bump: false
11 changes: 4 additions & 7 deletions .github/workflows/publish-to-pypi.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Deploy

on: push
on:
push:
tags:
- v*

jobs:
build-n-publish:
Expand All @@ -25,13 +28,7 @@ jobs:
python setup.py --version
- name: Build a binary wheel and a source tarball
run: python -m pep517.build --binary --source --out-dir dist .
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
if: startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.pypi_password }}
27 changes: 27 additions & 0 deletions .github/workflows/publish-to-test-pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
build-n-publish:
name: To PyPI and TestPyPI
runs-on: ubuntu-18.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.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install pep517
run: |
python -m pip install pep517 --user
python setup.py --version
- name: Build a binary wheel and a source tarball
run: python -m pep517.build --binary --source --out-dir dist .
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/

0 comments on commit 431136a

Please sign in to comment.