Skip to content

Commit

Permalink
Merge pull request #22 from cloudmitigator/automate_release
Browse files Browse the repository at this point in the history
Patch: Update pythonpublish.yml
  • Loading branch information
MikeSchapp committed Mar 26, 2020
2 parents 161178e + ae366f7 commit 30c5517
Showing 1 changed file with 43 additions and 19 deletions.
62 changes: 43 additions & 19 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,51 @@
name: Upload Python Package

on:
release:
types: [created]
push:
branches:
- master

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
export VERSION=${GITHUB_REF/refs\/tags\//}
python setup.py sdist bdist_wheel
twine upload dist/*
- uses: actions/checkout@v1
- 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 pyaml cloudmitigator-semantic
- name: See if Version Changed
run: |
CHANGED=$(semantic changed)
if [ "${CHANGED}" == "True" ]
then
echo ::set-env name=VERSION_CHANGED::${CHANGED}
echo ::set-env name=VERSION::$(semantic version)
echo ::set-env name=EGG::$(ls dist)
echo ::set-env name=RELEASE_BODY::$(semantic release-body)
fi
- name: Create Release
if: env.VERSION_CHANGED
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ env.VERSION }}
release_name: Release ${{ env.VERSION }}
body: ${{ env.RELEASE_BODY }}
draft: false
prerelease: false
- name: Build and publish
if: env.VERSION_CHANGED
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
export VERSION=${{ env.VERSION }}
python setup.py sdist bdist_wheel
twine upload dist/*

0 comments on commit 30c5517

Please sign in to comment.