diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index c130b1c3..cd1f2c76 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -7,7 +7,6 @@ env: jobs: build-and-test: - name: build-and-test-${{matrix.os}} runs-on: ${{matrix.os}} strategy: @@ -22,10 +21,51 @@ jobs: dotnet-version: ${{env.DOTNET_VERSION}} - name: Install dependencies - run: dotnet restore -p:FullTargets=false + run: dotnet restore -p:FullTargets=False - name: Build - run: dotnet build --no-restore -p:FullTargets=false + run: dotnet build --no-restore -p:FullTargets=False - name: Test - run: dotnet test --no-restore -p:FullTargets=false + run: dotnet test --no-restore -p:FullTargets=False + + build-and-publish: + name: build-and-publish + runs-on: ubuntu-latest + needs: build-and-test + if: github.ref == 'refs/heads/main' + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v3 + - name: Setup .NET Core + uses: actions/setup-dotnet@v3 + with: + dotnet-version: ${{env.DOTNET_VERSION}} + + - name: Install dependencies + run: dotnet restore -p:FullTargets=True + + - name: Build + run: dotnet build --no-restore -c Release -p:FullTargets=True + + - name: Pack + run: dotnet pack -c Release --no-build + + - name: Publish + run: dotnet nuget push ./AdvancedSharpAdbClient/bin/Release/*.nupkg --source "github" --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} + + - name: Get version + id: get_version + shell: pwsh + run: | + $version=(Select-Xml -Path ./Directory.Build.props -XPath 'Project/PropertyGroup/VersionPrefix').Node.InnerText + echo "version=$version" >> $env:GITHUB_OUTPUT + + - name: Upload + uses: actions/upload-artifact@v3 + with: + name: v${{ steps.get_version.outputs.version }} + path: ./AdvancedSharpAdbClient/bin/Release/ diff --git a/nuget.config b/nuget.config new file mode 100644 index 00000000..bad35838 --- /dev/null +++ b/nuget.config @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file