diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 446b951..2fb25bd 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,6 +1,41 @@ version: 2 updates: - - package-ecosystem: "nuget" - directory: "/" + # GitHub Actions + - package-ecosystem: github-actions + directory: / schedule: - interval: "weekly" + interval: weekly + day: sunday + timezone: Europe/Zurich + time: "01:30" + labels: + - dependencies/github-actions + + # .NET SDK + - package-ecosystem: dotnet-sdk + directory: / + schedule: + interval: weekly + day: sunday + timezone: Europe/Zurich + time: "02:00" + labels: + - dependencies/dotnet-sdk + groups: + dotnet-next: + update-types: + - major + - minor + dotnet-updates: + update-types: + - patch + + # NuGet + - package-ecosystem: nuget + directory: / + schedule: + interval: daily + timezone: Europe/Zurich + time: "03:00" + labels: + - dependencies/nuget diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..5238b16 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,60 @@ +name-template: "v$RESOLVED_VERSION" +tag-template: "v$RESOLVED_VERSION" +change-template: "- $TITLE by @$AUTHOR (#$NUMBER)" +no-changes-template: "- No changes" + +prerelease: true +prerelease-identifier: rc +include-pre-releases: true + +categories: + - title: "📚 Documentation" + labels: + - "documentation" + - title: "🚀 New Features" + labels: + - "enhancement" + - title: "🐛 Bug Fixes" + labels: + - "bug" + - title: "🚨 Security Updates" + labels: + - "security" + - title: "🔄 Dependency Updates" + collapse-after: 3 + labels: + - "dependencies/github-actions" + - "dependencies/containers" + - "dependencies/dotnet-sdk" + - "dependencies/nuget" + +version-resolver: + major: + labels: + - "major" + minor: + labels: + - "minor" + patch: + labels: + - "patch" + default: patch +template: | + $CHANGES + + ## 👨🏼‍💻 Contributors + + $CONTRIBUTORS +autolabeler: + - label: "dependencies/github-actions" + files: + - ".github/**/*" + - label: "dependencies/dotnet-sdk" + files: + - "global.json" + - label: "dependencies/nuget" + files: + - "Directory.Packages.props" + - label: "documentation" + files: + - "docs/**/*" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3321eb3..de460bf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,31 +1,71 @@ -name: dotnet build +name: Package -on: [push] +on: + pull_request: + types: + - opened + - synchronize + - reopened + push: + branches: + - main + workflow_dispatch: + +env: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + DOTNET_NOLOGO: true jobs: build: + name: Build runs-on: ubuntu-latest - strategy: - matrix: - dotnet-version: [ '7.0.x' ] steps: - uses: actions/checkout@v3 with: fetch-depth: '0' - - name: Setup .NET Core SDK ${{ matrix.dotnet-version }} + - name: Setup .NET Core SDK uses: actions/setup-dotnet@v3 with: - dotnet-version: ${{ matrix.dotnet-version }} + dotnet-version: | + 9.x + - name: Restore .NET Packages run: dotnet restore + - name: Build .NET Solution run: dotnet build --configuration Release --no-restore + + - name: Test .NET Solution + run: dotnet test --configuration Release --no-build --filter="Category=UnitTest|Category=IntegrationTest" --logger "trx;LogFilePrefix=test-results" + + - uses: actions/upload-artifact@v4 + if: success() || failure() + with: + name: test-results + path: "**/test-results*.trx" + - name: Pack .NET Solution - run: dotnet pack --no-build --output pack/ + run: dotnet pack --configuration Release --no-build --output pack/ + if: ${{ github.event_name == 'release' && github.ref_type == 'tag' || github.event.release.tag_name }} + - name: Publish .NET Solution to GitHub Packages continue-on-error: true - run: dotnet nuget push pack/* --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" + run: dotnet nuget push pack/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" + if: ${{ github.event_name == 'release' && github.ref_type == 'tag' || github.event.release.tag_name }} + + - name: Store .NET Package + uses: actions/upload-artifact@v4 + with: + name: nuget + if-no-files-found: error + retention-days: 7 + path: pack/*.nupkg + if: ${{ github.event_name == 'release' && github.ref_type == 'tag' || github.event.release.tag_name }} + - name: Publish .NET Solution to NuGet.org continue-on-error: true - run: dotnet nuget push pack/* --api-key ${{ secrets.NUGET_ORG_KEY }} --source nuget + env: + apikey: ${{ secrets.NUGET_ORG_KEY }} + run: dotnet nuget push pack/*.nupkg --api-key ${{ secrets.NUGET_ORG_KEY }} --source nuget + if: ${{ env.apikey != '' && github.event_name == 'release' && github.ref_type == 'tag' || github.event.release.tag_name }} diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..2ee3727 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,40 @@ +name: Release Drafter + +on: + push: + branches: + - main + pull_request_target: + types: + - edited + - opened + - reopened + - synchronize + workflow_dispatch: + inputs: + release-type: + type: choice + default: prerelease + description: Release Type + options: + - release + - prerelease + +concurrency: + group: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' && github.ref_type != 'tag' }} + +jobs: + update_release_draft: + name: "Update Release Draft" + permissions: + contents: write + pull-requests: write + runs-on: ubuntu-latest + steps: + - name: "Draft Release" + uses: release-drafter/release-drafter@v6.1.0 + with: + prerelease: ${{ github.event.inputs.release-type != 'release' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/global.json b/global.json index 70e3dcc..7f2000d 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,7 @@ { "sdk": { - "version": "7.0.100" + "version": "7.0.100", + "rollForward": "latestMajor", + "allowPrerelease": true } }