diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 046993b..feb6984 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,7 +6,12 @@ version: 2 updates: - package-ecosystem: "nuget" - directory: "/Google.Authenticator" - directory: "/Google.Authenticator.Tests" + directories: + - "/Google.Authenticator" + - "/Google.Authenticator.Tests" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/" schedule: interval: "weekly" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7368de4 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,41 @@ +name: build +on: + push: + branches: + - "**" + pull_request: + branches: + - "master" +jobs: + build_matrix: + strategy: + matrix: + os: [windows-latest, ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} + timeout-minutes: 15 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup .NET 6.0 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 6.0.x + - name: Setup .NET 7.0 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 7.0.x + - name: Restore Google.Authenticator + run: dotnet restore ./Google.Authenticator/Google.Authenticator.csproj + - name: Restore Google.Authenticator.Tests + run: dotnet restore ./Google.Authenticator.Tests/Google.Authenticator.Tests.csproj + - name: Build Package + run: dotnet build ./Google.Authenticator/Google.Authenticator.csproj --configuration Release --no-restore + - name: Build Tests + run: dotnet build ./Google.Authenticator.Tests/Google.Authenticator.Tests.csproj --configuration Release --no-restore --no-dependencies + - name: Test + run: dotnet test ./Google.Authenticator.Tests/Google.Authenticator.Tests.csproj --no-build --verbosity normal --configuration Release + - name: Pack + if: ${{ runner.os == 'Windows' && github.ref == 'refs/heads/master' && github.event_name != 'pull_request' }} + run: | + dotnet pack ./Google.Authenticator/Google.Authenticator.csproj --configuration $(buildConfiguration) --no-build + dotnet nuget push **\*.nupkg --source 'https://api.nuget.org/v3/index.json' --skip-duplicate -k ${{ secrets.NUGET_KEY }} diff --git a/README.md b/README.md index b233ed5..2fc33b0 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # GoogleAuthenticator Simple, easy to use server-side two-factor authentication library for .NET that works with Google Authenticator -[![Build Status](https://dev.azure.com/brandon-potter/GoogleAuthenticator/_apis/build/status/BrandonPotter.GoogleAuthenticator?branchName=master)](https://dev.azure.com/brandon-potter/GoogleAuthenticator/_build/latest?definitionId=1&branchName=master) +[![build](https://github.com/BrandonPotter/GoogleAuthenticator/actions/workflows/build.yml/badge.svg)](https://github.com/BrandonPotter/GoogleAuthenticator/actions/workflows/build.yml) [![NuGet Status](https://img.shields.io/nuget/v/GoogleAuthenticator.svg)](https://www.nuget.org/packages/GoogleAuthenticator/) [`Install-Package GoogleAuthenticator`](https://www.nuget.org/packages/GoogleAuthenticator) diff --git a/build/azure-pipeline.yaml b/build/azure-pipeline.yaml deleted file mode 100644 index c3b75c8..0000000 --- a/build/azure-pipeline.yaml +++ /dev/null @@ -1,64 +0,0 @@ -name: BrandonPotter.GoogleAuthenticator - build and test -trigger: [ master ] -pr: [ master ] - -variables: - buildConfiguration: Release - -jobs: -- job: Test - - strategy: - matrix: - linux: - imageName: 'ubuntu-latest' - mac: - imageName: 'macOS-latest' - windows: - imageName: 'windows-latest' - - pool: - vmImage: $(imageName) - - steps: - - # There is a legacy project in the solution that dotnet won't build, so restoring and building individual projects - - script: dotnet restore ./Google.Authenticator/Google.Authenticator.csproj - displayName: dotnet restore package - - - script: dotnet restore ./Google.Authenticator.Tests/Google.Authenticator.Tests.csproj --no-dependencies - displayName: dotnet restore tests - - - script: dotnet build ./Google.Authenticator/Google.Authenticator.csproj --configuration $(buildConfiguration) --no-restore - displayName: build package - - - script: dotnet build ./Google.Authenticator.Tests/Google.Authenticator.Tests.csproj --configuration $(buildConfiguration) --no-restore --no-dependencies - displayName: build tests - - - task: DotNetCoreCLI@2 - displayName: test - inputs: - command: test - projects: './Google.Authenticator.Tests/Google.Authenticator.Tests.csproj' - arguments: '--configuration $(buildConfiguration)' - -- job: Pack - dependsOn: Test - condition: and(succeeded('Test'), or(eq(variables['Build.SourceBranchName'], 'master'),eq(variables['Build.SourceBranchName'], 'develop'))) - - pool: - vmImage: 'windows-latest' - - steps: - # This creates the Nuget package only if the change was from "master". It also supports publishing from a "develop" branch, which is not currently used in this project - - script: dotnet build ./Google.Authenticator/Google.Authenticator.csproj --configuration $(buildConfiguration) - displayName: build package - - - script: dotnet pack ./Google.Authenticator/Google.Authenticator.csproj --configuration $(buildConfiguration) --no-build --output %Build_ArtifactStagingDirectory% - displayName: pack - - - task: PublishBuildArtifacts@1 - inputs: - pathtoPublish: '$(Build.ArtifactStagingDirectory)' - artifactName: NugetPackage -