You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by jk...@apache.org on 2022/04/04 18:57:12 UTC

[thrift] 01/01: THRIFT-5546: automate pypi publishing [ci skip]

This is an automated email from the ASF dual-hosted git repository.

jking pushed a commit to branch ci/pypi-automation
in repository https://gitbox.apache.org/repos/asf/thrift.git

commit bde8a84da584b2cd37ad19625738595491259211
Author: James E. King III <jk...@apache.org>
AuthorDate: Mon Apr 4 13:17:57 2022 -0400

    THRIFT-5546: automate pypi publishing [ci skip]
    
    When a pre-release is created on GitHub for the repo it will publish
    to the TestPyPI service, and if that pre-release is promoted to a
    release, it will publish to the PyPI (real) service.
---
 .github/actions/cloudtruth/configure-action |  1 +
 .github/actions/pypa/gh-action-pypi-publish |  1 +
 .github/workflows/publish.yml               | 51 +++++++++++++++++++++++++++++
 .gitmodules                                 |  6 ++++
 4 files changed, 59 insertions(+)

diff --git a/.github/actions/cloudtruth/configure-action b/.github/actions/cloudtruth/configure-action
new file mode 160000
index 000000000..9ec7a0ab1
--- /dev/null
+++ b/.github/actions/cloudtruth/configure-action
@@ -0,0 +1 @@
+Subproject commit 9ec7a0ab1c6e1bf92620c4a1b3fd38c614dc1659
diff --git a/.github/actions/pypa/gh-action-pypi-publish b/.github/actions/pypa/gh-action-pypi-publish
new file mode 160000
index 000000000..717ba43cf
--- /dev/null
+++ b/.github/actions/pypa/gh-action-pypi-publish
@@ -0,0 +1 @@
+Subproject commit 717ba43cfbb0387f6ce311b169a825772f54d295
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
new file mode 100644
index 000000000..b58b4c5eb
--- /dev/null
+++ b/.github/workflows/publish.yml
@@ -0,0 +1,51 @@
+#
+# Apache Thrift release publishing workflow
+#
+# When a release is created in GitHub, it should be created in pre-release
+# mode first.  This will trigger a "prereleased" event which will cause this
+# workflow to run and publish packages to various package managers.  You
+# must check the Actions tab in GitHub to see the result of the workflow.
+#
+# github.event.action is either "prereleased" or "released" and corresponds
+# with a named environment in CloudTruth
+#
+#           |         Destinations
+# Language  | Prereleased   | Released
+# ----------+---------------+---------------
+# py        | test.pypi.org | pypi.org
+#
+---
+name: Publish
+
+on:
+  release:
+    types:
+      - prereleased
+      - released
+
+permissions:
+  contents: read
+
+jobs:
+  pypi:
+    runs-on: ubuntu-latest
+    timeout-minutes: 5
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          persist-credentials: false
+          submodules: recursive
+      - uses: actions/setup-python@v3
+      - uses: ./.github/actions/cloudtruth/configure-action
+        with:
+          apikey: "${{ secrets.CLOUDTRUTH_API_KEY }}"
+          project: "${{ github.repository }}"
+          environment: "${{ github.event.action }}"
+      - name: build sdist
+        run: python setup.py sdist
+      - name: Publish to PyPI
+        uses: ./.github/actions/pypa/gh-action-pypi-publish
+        with:
+          user: "${{ env.PYPI_USERNAME }}"
+          password: "${{ env.PYPI_PASSWORD }}"
+          repository_url: "${{ env.PYPI_REPOSITORY }}"
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 000000000..bbaf357b3
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,6 @@
+[submodule ".github/actions/cloudtruth/configure-action"]
+	path = .github/actions/cloudtruth/configure-action
+	url = https://github.com/cloudtruth/configure-action
+[submodule ".github/actions/pypa/gh-action-pypi-publish"]
+	path = .github/actions/pypa/gh-action-pypi-publish
+	url = https://github.com/pypa/gh-action-pypi-publish