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 f15550d1add5c486a1ae0bb7287d0c62f38f82bf
Author: James E. King III <[email protected]>
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               | 52 +++++++++++++++++++++++++++++
 .gitmodules                                 |  6 ++++
 4 files changed, 60 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..5bc73a014
--- /dev/null
+++ b/.github/workflows/publish.yml
@@ -0,0 +1,52 @@
+#
+# 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
+      - name: Get configuration and secrets from CloudTruth
+        uses: ./.github/actions/cloudtruth/configure-action
+        with:
+          apikey: "${{ secrets.CLOUDTRUTH_API_KEY }}"
+          project: "${{ github.repository }}"
+          environment: "${{ github.event.action }}"
+      - name: build sdist
+        run: "cd lib/py && python setup.py sdist"
+      - name: Publish to PyPI
+        uses: ./.github/actions/pypa/gh-action-pypi-publish
+        with:
+          password: "${{ env.PYPI_PASSWORD }}"
+          repository_url: "${{ env.PYPI_REPOSITORY }}"
+          packages_dir: lib/py/dist
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

Reply via email to