From 426d5c9d95314f0d25faee4b31b2f8665ddbf7ec Mon Sep 17 00:00:00 2001 From: Ryan Kingsbury Date: Mon, 31 Jul 2023 17:49:32 -0400 Subject: [PATCH] CI: automatic releases and PyPi upload --- .github/workflows/post-process.yml | 26 +++++++++++++++++++++++ .github/workflows/release.yml | 34 ++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 .github/workflows/post-process.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/post-process.yml b/.github/workflows/post-process.yml new file mode 100644 index 00000000..c81981a2 --- /dev/null +++ b/.github/workflows/post-process.yml @@ -0,0 +1,26 @@ +name: Post-process + +on: + workflow_run: + types: + - completed + workflows: + # List all required workflow names here. + - 'testing' + +jobs: +# https://github.com/marketplace/actions/tag-release-on-push-action + auto-gen-release: + name: Tag/Release on merge of labeled PRs + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - # It is often a desired behavior to merge only when a workflow execution + # succeeds. This can be changed as needed. + if: ${{ github.event.workflow_run.conclusion == 'success' }} + uses: rymndhng/release-on-push-action@v0.27.0 + with: + # loonly release when PRs with release:major/minor/patch labels are merged + bump_version_scheme: norelease + use_github_release_notes: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..8f886159 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,34 @@ +name: release + +on: + release: + types: [published] + +jobs: + # https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes + + deploy: + runs-on: ubuntu-latest + environment: publish + + steps: + - uses: actions/checkout@v3 + + + - uses: actions/setup-python@v4 + with: + python-version: "3.10" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools setuptools_scm wheel tox + + - name: Build packages for distribution + run: | + tox -e build + + - name: Upload to PyPi + uses: pypa/gh-action-pypi-publish@v1.8.8 + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing