-
Notifications
You must be signed in to change notification settings - Fork 0
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 #22 from cloudmitigator/automate_release
Patch: Update pythonpublish.yml
- Loading branch information
Showing
1 changed file
with
43 additions
and
19 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 |
---|---|---|
@@ -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/* |