From 5065378de2a48c00e5abffc4bc895468a01e4581 Mon Sep 17 00:00:00 2001 From: Koen Date: Mon, 31 May 2021 01:33:26 +0800 Subject: [PATCH 1/2] Create build.yml --- .github/workflows/build.yml | 56 +++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..453b75c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,56 @@ + +name: .NET + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +env: + # Stop wasting time caching packages + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + # Disable sending usage data to Microsoft + DOTNET_CLI_TELEMETRY_OPTOUT: true + # GitHub Packages Feed settings + GITHUB_FEED: https://nuget.pkg.github.com/koenbeuk/ + GITHUB_USER: koenbeuk + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + dotnet-version: [3.1.x, 5.0.x, 6.0.x] + + steps: + - uses: actions/checkout@v2 + - name: Setup .NET + uses: actions/setup-dotnet@v1 + with: + dotnet-version: ${{ matrix.dotnet-version }} + include-prerelease: True + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore + - name: Test + run: dotnet test --no-build --verbosity normal + + prerelease: + needs: build + if: github.ref == 'refs/heads/master' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Pack + run: | + dotnet pack -v normal -c Debug --include-symbols --include-source -p:PackageVersion=1.0.0-pre-$GITHUB_RUN_ID -o nupkg + - name: Push to GitHub Feed + run: | + for f in ./nupkg/*.nupkg + do + dotnet nuget push $f --source $GITHUB_FEED --api-key ${{github.token}} --skip-duplicate --no-symbols true + done From 82a1c519bcd536fcf9a3f626a77dce7a7d7b4f56 Mon Sep 17 00:00:00 2001 From: Koen Date: Mon, 31 May 2021 01:39:21 +0800 Subject: [PATCH 2/2] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 453b75c..235b304 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,7 +23,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macOS-latest] - dotnet-version: [3.1.x, 5.0.x, 6.0.x] + dotnet-version: [5.0.x] steps: - uses: actions/checkout@v2