diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml new file mode 100644 index 000000000..09446baf1 --- /dev/null +++ b/.github/workflows/build-and-release.yml @@ -0,0 +1,28 @@ +name: build and publish + +on: + workflow_call: + inputs: + branch: + type: string + required: false +jobs: + release: + runs-on: ubuntu-22.04 + continue-on-error: false + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ inputs.branch }} + - name: Set up Python + uses: actions/setup-python@v4 + - name: Install python dependencies + run: | + python -m pip install --upgrade pip build + - name: Build sdist + run: | + python -m build -s + - name: Publish package + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/push-pr-unit-tests.yml b/.github/workflows/push-pr-unit-tests.yml index d33761ce1..55f61b625 100644 --- a/.github/workflows/push-pr-unit-tests.yml +++ b/.github/workflows/push-pr-unit-tests.yml @@ -15,3 +15,8 @@ jobs: push-pr-unit-tests-docker: name: Docker Unit Tests uses: ./.github/workflows/reusable-unit-tests-docker.yml + build-and-release: + name: Release to Pypi + needs: push-pr-unit-tests + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + uses: ./.github/workflows/build-and-release.yml