From b3b80fddbb82bc36c9de9ea7100da93b3624c742 Mon Sep 17 00:00:00 2001 From: Anush Date: Thu, 7 Mar 2024 16:37:26 +0530 Subject: [PATCH] ci: Release to Nuget.org (#48) * ci: release.yml * Rename build.yml to release.yml * ci: test.yml * chore: revert to "Build" test.yml --- .github/workflows/release.yml | 41 +++++++++++++++++++++++ .github/workflows/{build.yml => test.yml} | 22 ++++-------- 2 files changed, 47 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/release.yml rename .github/workflows/{build.yml => test.yml} (68%) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..0db2700 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,41 @@ +name: Release + +on: + release: + types: [ "published" ] + +permissions: + checks: write + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + + - name: Build + run: ./build.sh build + shell: bash + + - name: Pack + run: dotnet pack -c Release -o nuget --no-build --nologo + shell: bash + + - name: Publish NuGet package + env: + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} + run: dotnet nuget push nuget/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json + shell: bash + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: QdrantNupkg + path: nuget diff --git a/.github/workflows/build.yml b/.github/workflows/test.yml similarity index 68% rename from .github/workflows/build.yml rename to .github/workflows/test.yml index 6b234fd..b6d6203 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/test.yml @@ -1,12 +1,12 @@ name: Build on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - release: - types: [ "published" ] + pull_request: + types: + - opened + - edited + - synchronize + - reopened permissions: checks: write @@ -39,13 +39,3 @@ jobs: fail_on_failure: true require_tests: true report_paths: '**/output/test-results/junit-*.xml' - - - name: Pack - run: dotnet pack -c Release -o nuget --no-build --nologo - shell: bash - - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: QdrantNupkg - path: nuget