-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #142 from forslund/cicd/publish-from-master
Publish to pypi from master after tagging
- Loading branch information
Showing
1 changed file
with
9 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ name: Python package | |
on: | ||
push: | ||
branches: [ master ] | ||
tags: [ release/* ] | ||
|
||
jobs: | ||
build: | ||
|
@@ -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://[email protected]/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 |