CI: Add release workflow 12/71612/1 v0.1.0
authorAndrew Grimberg <agrimberg@linuxfoundation.org>
Fri, 21 Apr 2023 13:43:25 +0000 (06:43 -0700)
committerAndrew Grimberg <agrimberg@linuxfoundation.org>
Fri, 21 Apr 2023 13:43:25 +0000 (06:43 -0700)
Change-Id: Iba40840972220b079789954a6776bebe3892c2c9
Signed-off-by: Andrew Grimberg <agrimberg@linuxfoundation.org>
.github/workflows/release.yaml [new file with mode: 0644]

diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
new file mode 100644 (file)
index 0000000..3f3b734
--- /dev/null
@@ -0,0 +1,27 @@
+---
+name: PyPI release
+
+# yamllint disable-line rule:truthy
+on: push
+
+jobs:
+  publish:
+    if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v3
+      - name: Configure Python
+        uses: actions/setup-python@v4
+        with:
+          python-version: '3.8'
+      - name: Build package distribution files
+        run: >-
+          pipx run tox -e clean,build
+      - name: Configure TWINE
+        run: |
+          echo "TWINE_USERNAME=__token__" >> $GITHUB_ENV
+          echo "TWINE_PASSWORD=${{ secrets.PYPI_API_TOKEN }}" >> $GITHUB_ENV
+      - name: Publish to PyPI
+        run: >-
+          pipx run tox -e publish -- --repository pypi