Browse Source

add python publish

liuyuqi-dellpc 1 year ago
parent
commit
94bae67451
2 changed files with 73 additions and 13 deletions
  1. 18 0
      .github/workflows/welcome.yml
  2. 55 13
      python/.github/workflows/publish.yml

+ 18 - 0
.github/workflows/welcome.yml

@@ -0,0 +1,18 @@
+name: Welcome WorkFlow
+
+on:
+  issues:
+    types: [opened]
+  pull_request_target:
+    types: [opened]
+
+jobs:
+  build:
+    name: 👋 Welcome
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/first-interaction@v1.1.1
+        with:
+          repo-token: ${{ secrets.GITHUB_TOKEN }}
+          issue-message: "Hello there, thank you for opening an Issue ! 🙏🏻 The team was notified and they will get back to you asap."
+          pr-message:  "Hello there, thank you for opening an PR ! 🙏🏻 The team was notified and they will get back to you asap."

+ 55 - 13
python/.github/workflows/publish.yml

@@ -1,13 +1,55 @@
-- name: Install dependencies
-  run: |
-    python -m pip install --upgrade pip
-    pip install setuptools wheel twine
-    python setup.py install
-
-- name: Build and publish
-  env:
-    TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
-    TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
-  run: |
-    python setup.py sdist bdist_wheel
-    twine upload dist/*
+name: Releases to PyPi
+on:
+  push:
+    tags:
+      - '[0-9]+.[0-9]+[0-9]+.[0-9]'
+      - '[0-9]+.[0-9]+[0-9]+.[0-9]'
+      - '[0-9]+.[0-9]+[0-9]+.[0-9]'
+  
+  # Allows you to run this workflow manually from the Actions tab
+  workflow_dispatch:
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        python-version: [3.8]
+    steps:
+      - name: 🛎️ Checkout
+        uses: actions/checkout@v3
+        with:
+          ref: ${{ github.head_ref }}
+
+      - name: 🐍 Set up Python ${{ matrix.python-version }}
+        uses: actions/setup-python@v4
+        with:
+          python-version: ${{ matrix.python-version }}
+
+      - name: Install dependencies
+        run: |
+          python -m pip install --upgrade pip
+          pip install --upgrade build setuptools wheel twine
+          python setup.py install
+
+      - name: Build source and wheel distributions
+        env:
+          TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
+          TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
+        run: |
+          python setup.py sdist bdist_wheel
+          twine upload dist/*
+        # python -m build
+
+      - name: 🚀 Publish to PyPi
+        uses: pypa/gh-action-pypi-publish@release/v1
+        with:
+          user: ${{ secrets.PYPI_USERNAME }}
+          password: ${{ secrets.PYPI_PASSWORD }}
+
+      - name: 🚀 Publish to Test-PyPi
+        uses: pypa/gh-action-pypi-publish@release/v1
+        with:
+          repository-url: https://test.pypi.org/legacy/
+          user: ${{ secrets.PYPI_TEST_USERNAME }}
+          password: ${{ secrets.PYPI_TEST_PASSWORD }}