diff --git a/.github/workflows/build-test-release.yml b/.github/workflows/build-test-release.yml new file mode 100644 index 0000000..b0fcd83 --- /dev/null +++ b/.github/workflows/build-test-release.yml @@ -0,0 +1,60 @@ +name: Build, test and release MKCards2 + +on: + push: + branches: [main, dev, feat-*] + tags: + - "v*.*.*" + pull_request: + branches: [main, dev] + workflow_dispatch: + +permissions: + contents: write + +jobs: + build-and-test: + name: Test on ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "8.0.x" + + - name: Restore dependencies + run: dotnet restore MKCards2/MKCards2.sln + + - name: Build project + run: dotnet build MKCards2/MKCards2.sln --configuration Release --no-restore + + - name: Run unit tests + run: dotnet test MKCards2/MKCards2.sln --configuration Release --no-build --verbosity normal + + # publish-nuget: + # name: Publish NuGet Package + # needs: build-and-test + # runs-on: ubuntu-latest + # if: startsWith(github.ref, 'refs/tags/v') + + # steps: + # - name: Checkout code + # uses: actions/checkout@v4 + + # - name: Setup .NET + # uses: actions/setup-dotnet@v4 + # with: + # dotnet-version: "8.0.x" + + # - name: Create NuGet Package + # run: dotnet pack src/MKCards2.Core/MKCards2.Core.csproj --configuration Release -o ./nuget_out + + # - name: Push to NuGet.org + # run: dotnet nuget push ./nuget_out/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate