Преглед на файлове

Added github actions to automate the PyPi package build

Alex Gheorghita преди 4 години
родител
ревизия
9d5ae61390
променени са 1 файла, в които са добавени 46 реда и са изтрити 0 реда
  1. 46 0
      .github/workflows/main.yml

+ 46 - 0
.github/workflows/main.yml

@@ -0,0 +1,46 @@
+name: Publish to PyPI
+
+on:
+    push:
+        branches: [master]
+
+    # Allows you to run this workflow manually from the Actions tab
+    workflow_dispatch:
+
+jobs:
+    build:
+        runs-on: ubuntu-latest
+        steps:
+            - name: Prepare repo
+              uses: actions/checkout@v2
+            - name: Setup Python
+              uses: actions/setup-python@v1
+              with:
+                  python-version: 3.9
+            - name: Install pypa/build
+              run: >-
+                  python -m
+                  pip install
+                  build
+                  --user
+
+            - name: Build a binary wheel and a source tarball
+              run: >-
+                  python -m
+                  build
+                  --sdist
+                  --wheel
+                  --outdir dist/
+                  .
+            #       - name: Publish distribution 📦 to Test PyPI
+            #         uses: pypa/gh-action-pypi-publish@master
+            #         with:
+            #           skip_existing: true
+            #           password: ${{ secrets.TEST_PIP_API_TOKEN }}
+            #           repository_url: https://test.pypi.org/legacy/
+
+            - name: Publish distribution 📦 to PyPI
+              if: ${{ startsWith(github.ref, 'refs/tags') }}
+              uses: pypa/gh-action-pypi-publish@master
+              with:
+                  password: ${{ secrets.PIP_API_TOKEN }}