Browse Source

add dotnet

liuyuqi-dellpc 4 years ago
parent
commit
37d9debdbd

+ 63 - 0
dotnet/.github/workflows/main.yml

@@ -0,0 +1,63 @@
+name: CI
+on:
+  push:
+    branches: [ master ]
+  pull_request:
+    branches: [ master ]
+jobs:
+  build:
+    if: github.event_name == 'push' && contains(toJson(github.event.commits), '***NO_CI***') == false && contains(toJson(github.event.commits), '[ci skip]') == false && contains(toJson(github.event.commits), '[skip ci]') == false
+      name: Build Package
+      runs-on: ubuntu-latest
+
+      steps:
+        - uses: actions/checkout@v2
+
+        - name: Setup .NET Core SDK
+          uses: actions/setup-dotnet@v1
+          with:
+            dotnet-version: 3.1.100
+
+        - name: Pack
+          run: dotnet pack TestLib --configuration Release -o finalpackage --no-build
+
+        - name: Publish artifact
+          uses: actions/upload-artifact@master
+          with:
+            name: nupkg
+            path: finalpackage
+
+  deploy:
+    needs: build
+    name: Deploy Packages
+    runs-on: windows-latest # using windows agent due to nuget can't sign on linux yet
+    steps:
+      - name: Download Package artifact
+        uses: actions/download-artifact@master
+        with:
+          name: nupkg
+
+      - name: Setup NuGet
+        uses: NuGet/setup-nuget@v1.0.2
+        with:
+          nuget-api-key: ${{ secrets.NUGET_API_KEY }}
+          nuget-version: latest
+
+      - name: Setup .NET Core SDK
+        uses: actions/setup-dotnet@v1
+        with:
+          dotnet-version: 3.1.100
+
+      - name: Get certificate
+        id: cert_file
+        uses: timheuer/base64-to-file@master
+        with:
+          fileName: 'certfile.pfx'
+          encodedString: ${{ secrets.SIGNING_CERT }}
+
+      # Sign the package
+      - name: Sign NuGet Package
+        run: nuget sign nupkg\*.nupkg -CertificatePath ${{ steps.cert_file.outputs.filePath }} -CertificatePassword ${{ secrets.CERT_PWD }}  -Timestamper http://timestamp.digicert.com –NonInteractive
+
+      - name: Push to NuGet
+        run: dotnet nuget push nupkg\*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://nuget.org

+ 5 - 0
dotnet/README.md

@@ -0,0 +1,5 @@
+## dotnet action
+
+实现自动构建项目,生成可执行包。签名,上传到 github package 。
+
+

+ 15 - 1
python/.github/workflows/autoci.yml

@@ -45,4 +45,18 @@ jobs:
           branch: 'master'
           commit_message: 'Update Host'
         env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Publish distribution 📦 to Test PyPI
+        uses: pypa/gh-action-pypi-publish@master
+        with:
+          user: __token__
+          password: ${{ secrets.test_pypi_password }}
+          repository_url: https://test.pypi.org/legacy/
+
+      - name: Publish distribution 📦 to PyPI
+        if: startsWith(github.event.ref, 'refs/tags')
+        uses: pypa/gh-action-pypi-publish@master
+        with:
+          user: __token__
+          password: ${{ secrets.pypi_password }}

+ 0 - 0
python/.github/workflows/main.yml → python/.github/workflows/cache.yml


+ 12 - 0
python/.github/workflows/publish.yml

@@ -0,0 +1,12 @@
+- name: Install dependencies
+  run: |
+    python -m pip install --upgrade pip
+    pip install setuptools wheel twine
+
+- 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/*