From e31ef6bb2e677d0c9dae311a65552520142ed3e6 Mon Sep 17 00:00:00 2001 From: Shirshanka Das Date: Tue, 26 Apr 2022 11:04:21 -0700 Subject: [PATCH] feat(ci): adding publish to pypi action (#3) --- .github/workflows/publish-to-pypi.yml | 41 +++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/publish-to-pypi.yml diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml new file mode 100644 index 0000000..6f5186d --- /dev/null +++ b/.github/workflows/publish-to-pypi.yml @@ -0,0 +1,41 @@ +name: pypi-release +on: + release: + types: [published] + +jobs: + setup: + runs-on: ubuntu-latest + outputs: + tag: ${{ steps.tag.outputs.tag }} + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Compute Tag + id: tag + run: | + echo "GITHUB_REF: $GITHUB_REF" + SHORT_SHA=$(git rev-parse --short "$GITHUB_SHA") + TAG=$(echo ${GITHUB_REF} | sed -e 's,refs/tags/v,,g') + echo "tag=$TAG" + echo "::set-output name=tag::$TAG" + push_to_pypi: + name: Build and push python package to PyPI + runs-on: ubuntu-latest + needs: setup + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.9.9' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine build + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} + TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} + run: | + RELEASE_VERSION=${{ needs.setup.outputs.tag }} ./scripts/release.sh