|
| 1 | +@rem Copyright 2019 Google LLC. All rights reserved. |
| 2 | +@rem |
| 3 | +@rem Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +@rem you may not use this file except in compliance with the License. |
| 5 | +@rem You may obtain a copy of the License at |
| 6 | +@rem |
| 7 | +@rem http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +@rem |
| 9 | +@rem Unless required by applicable law or agreed to in writing, software |
| 10 | +@rem distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +@rem See the License for the specific language governing permissions and |
| 13 | +@rem limitations under the License. |
| 14 | + |
| 15 | +@echo "Starting Windows release" |
| 16 | + |
| 17 | +cd /d %~dp0..\..\..\packages\google-crc32c || goto :error |
| 18 | + |
| 19 | +if "%PUBLISH_WHEELS%"=="" set PUBLISH_WHEELS=true |
| 20 | + |
| 21 | +@echo "Build and Test Wheels" |
| 22 | +call scripts\windows\build.bat || goto :error |
| 23 | + |
| 24 | +@echo "Ensure that we have the latest versions of Twine, Wheel, Setuptools, and pkginfo." |
| 25 | +call py -3 -m pip install --upgrade twine wheel setuptools pkginfo || goto :error |
| 26 | + |
| 27 | +@echo "Build the source distribution (sdist) and validate with twine check" |
| 28 | +call py -3 setup.py sdist || goto :error |
| 29 | +call py -3 -m twine check dist/* wheels/google_crc32c* || goto :error |
| 30 | + |
| 31 | +if "%PUBLISH_WHEELS%"=="true" ( |
| 32 | + @echo "Start the releasetool reporter" |
| 33 | + call py -3 -m pip install gcp-releasetool || goto :error |
| 34 | + if not exist C:\temp mkdir C:\temp |
| 35 | + call py -3 -m releasetool publish-reporter-script > C:\temp\publisher-script || goto :error |
| 36 | + |
| 37 | + @echo "Disable buffering, so that the logs stream through." |
| 38 | + set PYTHONUNBUFFERED=1 |
| 39 | + |
| 40 | + @echo "## RELEASE WORKFLOW SUCCESSFUL ##" |
| 41 | + @echo "## Uploading Wheels and sdist ##" |
| 42 | + |
| 43 | + set /p TWINE_PASSWORD=<%KOKORO_KEYSTORE_DIR%/73713_google-cloud-pypi-token-keystore-3 |
| 44 | + call py -3 -m twine upload --skip-existing --username __token__ --password "%TWINE_PASSWORD%" dist/* wheels/google_crc32c* || goto :error |
| 45 | + dir wheels |
| 46 | + dir dist |
| 47 | +) else ( |
| 48 | + @echo "PUBLISH_WHEELS is '%PUBLISH_WHEELS%'. Skipping PyPI upload after sdist and wheel validation." |
| 49 | +) |
| 50 | + |
| 51 | +goto :EOF |
| 52 | + |
| 53 | +:error |
| 54 | +exit /b 1 |
0 commit comments