Skip to content

Commit

Permalink
Merge pull request #142 from forslund/cicd/publish-from-master
Browse files Browse the repository at this point in the history
Publish to pypi from master after tagging
  • Loading branch information
krisgesling authored Jul 26, 2021
2 parents 5b6e10f + bf6d6bf commit 8e10b81
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ name: Python package
on:
push:
branches: [ master ]
tags: [ release/* ]

jobs:
build:
Expand Down Expand Up @@ -45,24 +44,16 @@ jobs:
- name: Tag release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
git remote add tag_target "https://$GITHUB_TOKEN@github.com/MycroftAI/adapt.git"
VERSION=$(python setup.py --version)
git tag -f release/v$VERSION || exit 0
git push tag_target --tags || exit 0
publish:
runs-on: ubuntu-latest
if: contains(github.ref, '/tags/release')
needs: build
steps:
- uses: actions/checkout@v2
- name: Push to pypi
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
pip install twine wheel
python setup.py sdist bdist_wheel
twine check dist/*
twine upload dist/*
if git push tag_target --tags; then
echo "New tag published on github, push to pypi as well."
pip install twine wheel
python setup.py sdist bdist_wheel
twine check dist/*
twine upload dist/*
fi

0 comments on commit 8e10b81

Please sign in to comment.