This repository has been archived by the owner on Oct 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split Python CI into PR and release pipelines
- Loading branch information
1 parent
836f0bc
commit 7fe05d1
Showing
2 changed files
with
57 additions
and
37 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,57 @@ | ||
--- | ||
|
||
name: Python | ||
|
||
"on": | ||
push: | ||
branches: | ||
- develop | ||
tags: | ||
- "v[0-9]+.[0-9]+.[0-9]+" # release | ||
- "v[0-9]+.[0-9]+.[0-9]+-a[0-9]+" # alpha | ||
- "v[0-9]+.[0-9]+.[0-9]+-pre[0-9]+" # pre-release / rc | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.8"] | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Push release to PyPI | ||
env: | ||
TWINE_USERNAME: __token__ | ||
twine_test_password: ${{ secrets.TWINE_TEST_PASSWORD }} | ||
twine_prod_password: ${{ secrets.TWINE_PASSWORD }} | ||
run: | | ||
cd grpc/clients/python | ||
github_tag="${GITHUB_REF#refs/tags/v}" | ||
if [[ "$v" =~ ^v[0-9]+.[0-9]+.[0-9]+-a[0-9]+$ ]] ; then | ||
echo "This is an alpha release." | ||
# Inject the version, rather than requiring it in setup.py. | ||
sed --in-place -e 's#^VERSION.*$#VERSION = "'"$github_tag"'"#' setup.py | ||
make_target=dist_test | ||
export TWINE_PASSWORD="$twine_test_password" | ||
else | ||
echo "This is a (pre)release." | ||
setuppy_tag="$(python -c "$(awk '/^VERSION = /' setup.py); print(VERSION)")" | ||
make_target=dist | ||
export TWINE_PASSWORD="$twine_prod_password" | ||
fi | ||
if [[ "$github_tag" != "$setuppy_tag" ]] ; then | ||
echo "Tags do not match." | ||
echo "Github: $github_tag" | ||
echo "setup.py: $setuppy_tag" | ||
exit 1 | ||
fi | ||
command -v twine 1>/dev/null || pip install twine | ||
make "$make_target" |
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