publish-pypi-release #30
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
name: publish-pypi-release | |
on: | |
workflow_dispatch: | |
inputs: | |
is_test: | |
description: "Use Test Pypi" | |
required: true | |
type: boolean | |
default: true | |
jobs: | |
build-release: | |
name: Build and publish to pypi | |
runs-on: ubuntu-8core | |
timeout-minutes: 10 | |
environment: | |
name: release | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: "16.x" | |
- run: | | |
pip install build twine | |
./build_dist.py | |
if [[ -n "$(git status weave/frontend/sha1.txt --porcelain)" ]] | |
then | |
echo "::error cannot publish release, commited SHA does not match build SHA" | |
exit 1 | |
fi | |
- name: upload test distribution | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
if: ${{ inputs.is_test }} | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
- name: upload distribution | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
if: ${{ !inputs.is_test }} |