diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..5778a3d --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,16 @@ +name-template: 'v$NEXT_PATCH_VERSION' +tag-template: 'v$NEXT_PATCH_VERSION' +template: | + # What's Changed + + $CHANGES +categories: + - title: '🚀 Features' + label: 'Feature' + - title: '🐛 Bug Fixes' + label: 'Bug' + - title: '🧰 Maintenance' + label: 'Maintenance' + - title: '📖 Documentation' + label: 'Docs' +change-template: '- (#$NUMBER) $TITLE - Thanks to @$AUTHOR ' \ No newline at end of file diff --git a/.github/workflows/ci-main.yml b/.github/workflows/ci-main.yml new file mode 100644 index 0000000..49c29ac --- /dev/null +++ b/.github/workflows/ci-main.yml @@ -0,0 +1,54 @@ +name: Build Main + +on: + push: + branches: [ main ] + release: + types: [ published ] + +env: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + DOTNET_CLI_TELEMETRY_OPTOUT: true + PROJECT_NAME: BlazorTurnstile + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NUGET_FEED: https://api.nuget.org/v3/index.json + NUGET_KEY: ${{ secrets.NUGET_KEY }} + +jobs: + build: + name: Build and pack + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + + - name: Restore + run: dotnet restore + + - name: Build + run: dotnet build -c Release --no-restore src/$PROJECT_NAME/$PROJECT_NAME.csproj + + deploy: + needs: build + if: github.event_name == 'release' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + + - name: Create Release NuGet package + run: | + arrTag=(${GITHUB_REF//\// }) + VERSION="${arrTag[2]}" + echo Version: $VERSION + VERSION="${VERSION/v}" + echo Clean Version: $VERSION + dotnet pack -v normal -c Release --include-symbols --include-source -p:PackageVersion=$VERSION -o nupkg src/$PROJECT_NAME/$PROJECT_NAME.csproj + + - name: Push to NuGet Feed + run: dotnet nuget push ./nupkg/*.nupkg --source $NUGET_FEED --api-key $NUGET_KEY --skip-duplicate diff --git a/.github/workflows/ci-pr.yml b/.github/workflows/ci-pr.yml new file mode 100644 index 0000000..48c66ee --- /dev/null +++ b/.github/workflows/ci-pr.yml @@ -0,0 +1,24 @@ +name: Build PR + +on: + pull_request: + branches: [ main ] + +env: + PROJECT_NAME: BlazorTurnstile + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + + - name: Restore + run: dotnet restore + + - name: Build + run: dotnet build -c Release --no-restore src/$PROJECT_NAME/$PROJECT_NAME.csproj diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..1acb929 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,20 @@ +name: Release Drafter + +on: + push: + branches: [ main ] + +permissions: + contents: read + +jobs: + update_release_draft: + permissions: + # write permission is required to create a github release + contents: write + + runs-on: ubuntu-latest + steps: + - uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/BlazorTurnstile.sln b/BlazorTurnstile.sln index 80894a5..f273508 100644 --- a/BlazorTurnstile.sln +++ b/BlazorTurnstile.sln @@ -8,13 +8,16 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CCBFA76A-6F1C-4707-8424-77DCD36BAE1E}" ProjectSection(SolutionItems) = preProject .gitignore = .gitignore + .github\workflows\ci-main.yml = .github\workflows\ci-main.yml + .github\workflows\ci-pr.yml = .github\workflows\ci-pr.yml + global.json = global.json LICENSE = LICENSE README.md = README.md EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{0C00FBA8-0C21-43E5-AA2F-88754D087503}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorWebAssembly", "samples\BlazorWebAssembly\BlazorWebAssembly.csproj", "{88185F43-375F-4D3B-B720-70C4C6487DD8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorWebAssembly", "samples\BlazorWebAssembly\BlazorWebAssembly.csproj", "{88185F43-375F-4D3B-B720-70C4C6487DD8}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/global.json b/global.json new file mode 100644 index 0000000..1c7274b --- /dev/null +++ b/global.json @@ -0,0 +1,6 @@ +{ + "sdk": { + "version": "7.0.100", + "rollForward": "latestFeature" + } +} \ No newline at end of file diff --git a/src/BlazorTurnstile/BlazorTurnstile.csproj b/src/BlazorTurnstile/BlazorTurnstile.csproj index b22ae83..f96b739 100644 --- a/src/BlazorTurnstile/BlazorTurnstile.csproj +++ b/src/BlazorTurnstile/BlazorTurnstile.csproj @@ -1,4 +1,4 @@ - + net6.0;net7.0 @@ -20,6 +20,10 @@ https://github.com/MichelJansson/BlazorTurnstile git https://github.com/MichelJansson/BlazorTurnstile + + + true + true @@ -29,13 +33,11 @@ - -