-
Notifications
You must be signed in to change notification settings - Fork 479
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 #1141 from mariocj89/pu/auto-relase
Automate cutting new releases
- Loading branch information
Showing
6 changed files
with
122 additions
and
126 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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# This workflow is triggered three ways: | ||
# | ||
# 1. Manually triggering the workflow via the GitHub UI (Actions > Upload | ||
# package) will upload to test.pypi.org without the need to create a tag. | ||
# 2. When a tag is created, the workflow will upload the package to | ||
# test.pypi.org. | ||
# 3. When a GitHub Release is made, the workflow will upload the package to pypi.org. | ||
# | ||
# It is done this way until PyPI has draft reviews, to allow for a two-stage | ||
# upload with a chance for manual intervention before the final publication. | ||
name: Upload package | ||
|
||
on: | ||
release: | ||
types: [created] | ||
push: | ||
tags: | ||
- '*' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.9' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -U tox | ||
- name: Create tox environments | ||
run: | | ||
tox -p -e py,build,release --notest | ||
- name: Run tests | ||
run: | | ||
tox -e py | ||
- name: Build package | ||
run: | | ||
tox -e build | ||
- name: Publish package | ||
env: | ||
TWINE_USERNAME: "__token__" | ||
run: | | ||
if [[ "$GITHUB_EVENT_NAME" == "push" || \ | ||
"$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then | ||
export TWINE_REPOSITORY_URL="https://test.pypi.org/legacy/" | ||
export TWINE_PASSWORD="${{ secrets.TEST_PYPI_UPLOAD_TOKEN }}" | ||
elif [[ "$GITHUB_EVENT_NAME" == "release" ]]; then | ||
export TWINE_REPOSITORY="pypi" | ||
export TWINE_PASSWORD="${{ secrets.PYPI_UPLOAD_TOKEN }}" | ||
else | ||
echo "Unknown event name: ${GITHUB_EVENT_NAME}" | ||
exit 1 | ||
fi | ||
tox -e release |
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
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
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
This file was deleted.
Oops, something went wrong.
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