diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..ba95f64 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "nuget" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml new file mode 100644 index 0000000..e38cdb7 --- /dev/null +++ b/.github/workflows/dotnet.yml @@ -0,0 +1,22 @@ +name: Build and Test + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + name: Build & Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 7.0.x + - name: Restore + run: dotnet restore + - name: Test + run: dotnet test -c Release --verbosity normal \ No newline at end of file diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml new file mode 100644 index 0000000..51d5daa --- /dev/null +++ b/.github/workflows/nuget.yml @@ -0,0 +1,32 @@ +# https://acraven.medium.com/a-nuget-package-workflow-using-github-actions-7da8c6557863 +name: Upload package to NuGet + +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + +jobs: + build: + name: Upload package to NuGet + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 7.0.x + - name: Restore + run: dotnet restore + - name: Set VERSION variable from tag + run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV + - name: Build + run: dotnet build -c Release --no-restore /p:Version=${VERSION} /p:PackageVersion=${VERSION} +# - name: Test +# run: dotnet test -c Release --no-restore --no-build + - name: Pack + run: dotnet pack -c Release /p:Version=${VERSION} --no-restore + - name: Upload Package + run: dotnet nuget push NPTicket/bin/Release/NPTicket.${VERSION}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${NUGET_TOKEN} + env: + NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }} \ No newline at end of file