From 2081975c9a446c57247afb7e100e14b5d066f79f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Hansen?= Date: Fri, 26 Jan 2024 03:05:59 +0100 Subject: [PATCH] feature: add github workflows --- .github/workflows/dotnet-build.yml | 33 +++++++++++++++++++++++++ .github/workflows/release-created.yml | 26 +++++++++++++++++++ .github/workflows/release-please.yml | 18 ++++++++++++++ .github/workflows/release-published.yml | 27 ++++++++++++++++++++ 4 files changed, 104 insertions(+) create mode 100644 .github/workflows/dotnet-build.yml create mode 100644 .github/workflows/release-created.yml create mode 100644 .github/workflows/release-please.yml create mode 100644 .github/workflows/release-published.yml diff --git a/.github/workflows/dotnet-build.yml b/.github/workflows/dotnet-build.yml new file mode 100644 index 0000000..9dee73f --- /dev/null +++ b/.github/workflows/dotnet-build.yml @@ -0,0 +1,33 @@ +name: .NET continuous build and test + +on: + push: + branches: + - '*' + paths: + - 'src/**' + - 'test/**' + - 'examples/**' + - '*.sln' + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore + - name: Test + run: dotnet test --no-build --verbosity normal + - name: Pack OneOf.Extensions.Blazor + run: dotnet pack src/OneOf.Extensions.Blazor/ -c Release -o ./artifacts --include-source --verbosity minimal -p:PackageVersion=0.1.${{ github.run_number }}-alpha + - name: Push to nuget.org + run: dotnet nuget push ./artifacts/*.nupkg --source "https://api.nuget.org/v3/index.json" --api-key ${{ secrets.NUGET_TOKEN }} diff --git a/.github/workflows/release-created.yml b/.github/workflows/release-created.yml new file mode 100644 index 0000000..1fc11e1 --- /dev/null +++ b/.github/workflows/release-created.yml @@ -0,0 +1,26 @@ +name: On Release Created + +on: + release: + types: [created] + +jobs: + build_prelease_nuget_package: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore + - name: Test + run: dotnet test --no-build --verbosity normal + - name: Pack OneOf.Extensions.Blazor + run: dotnet pack src/OneOf.Extensions.Blazor/ -c Release -o ./artifacts --include-source --verbosity minimal -p:PackageVersion=${{ github.event.release.tag_name }}-${{ github.run_number }}-rc + - name: Push to nuget.org + run: dotnet nuget push ./artifacts/*.nupkg --source "https://api.nuget.org/v3/index.json" --api-key ${{ secrets.NUGET_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..42fd107 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,18 @@ +on: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + +name: release-please + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: google-github-actions/release-please-action@v4 + with: + release-type: simple diff --git a/.github/workflows/release-published.yml b/.github/workflows/release-published.yml new file mode 100644 index 0000000..85753de --- /dev/null +++ b/.github/workflows/release-published.yml @@ -0,0 +1,27 @@ +name: .NET Publish + +on: + release: + types: [ published ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + - name: Restore dependencies + run: dotnet restore --configuration Release --verbosity minimal + - name: Build + run: dotnet build --configuration Release --no-restore --verbosity minimal + - name: Test + run: dotnet test --configuration Release --no-build --verbosity minimal + - name: Pack OneOf.Extensions.Blazor + run: dotnet pack src/OneOf.Extensions.Blazor/ -c Release -o ./artifacts --include-source --verbosity minimal -p:PackageVersion=${{ github.event.release.tag_name }} + - name: Push to nuget.org + run: dotnet nuget push ./artifacts/*.nupkg --source "https://api.nuget.org/v3/index.json" --api-key ${{ secrets.NUGET_TOKEN }} \ No newline at end of file