diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml new file mode 100644 index 0000000..65c1256 --- /dev/null +++ b/.github/workflows/build-and-release.yml @@ -0,0 +1,49 @@ +name: Build and Release Package + +# This action will start when a correctly formatted tag is pushed (e.g. v0.1.0) + +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + workflow_dispatch: + +jobs: + build: + runs-on: windows-latest + + steps: + + - name: Set Version Variable + if: ${{ github.ref_type == 'tag' }} + env: + TAG: ${{ github.ref_name }} + run: echo "VERSION=${TAG#v}" >> $GITHUB_ENV + + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup .NET 6 + uses: actions/setup-dotnet@v2 + with: + dotnet-version: 6.0.x + + - name: Setup .NET 7 + uses: actions/setup-dotnet@v2 + with: + dotnet-version: 7.0.x + + - name: Setup .NET 8 + uses: actions/setup-dotnet@v2 + with: + dotnet-version: 8.0.x + + - name: Build project + run: dotnet build src\HC.PageNotFoundManager\HC.PageNotFoundManager.csproj --configuration Release /p:Version=$VERSION + + - name: Pack project + run: dotnet pack --output nupkgs /p:PackageVersion=$VERSION .\src\PageNotFoundManager.sln + + - name: upload nuget package + if: github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v') + run: dotnet nuget push **\*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..f1951a9 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,50 @@ +name: Build and Release Package + +on: + push: + branches: ["develop"] + pull_request: + branches: ["develop"] + workflow_dispatch: + +jobs: + build: + runs-on: windows-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Get next version + uses: reecetech/version-increment@2023.9.3 + id: version + with: + scheme: semver + increment: patch + release_branch: main + + - name: Set Version Variable + env: + TAG: ${{ steps.version.outputs.version }} + run: echo "VERSION=${TAG#v}" >> $GITHUB_ENV + + - name: Setup .NET 6 + uses: actions/setup-dotnet@v2 + with: + dotnet-version: 6.0.x + + - name: Setup .NET 7 + uses: actions/setup-dotnet@v2 + with: + dotnet-version: 7.0.x + + - name: Setup .NET 8 + uses: actions/setup-dotnet@v2 + with: + dotnet-version: 8.0.x + + - name: Build project + run: dotnet build src\HC.PageNotFoundManager\HC.PageNotFoundManager.csproj --configuration Release /p:Version=$VERSION + + - name: Pack project + run: dotnet pack --output nupkgs /p:PackageVersion=$VERSION .\src\PageNotFoundManager.sln diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 8730218..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Release Package - -# This action will start when a correctly formatted tag is pushed (e.g. 0.1.0) - -on: - push: - tags: - - "[0-9]+.[0-9]+.[0-9]+" - -jobs: - build: - - runs-on: windows-latest - - steps: - - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Setup .NET 6 - uses: actions/setup-dotnet@v2 - with: - dotnet-version: 6.0.x - - - name: Setup .NET 7 - uses: actions/setup-dotnet@v2 - with: - dotnet-version: 7.0.x - - - name: Setup .NET 8 - uses: actions/setup-dotnet@v2 - with: - dotnet-version: 8.0.x - - - name: Build project - run: dotnet build src\HC.PageNotFoundManager\HC.PageNotFoundManager.csproj --configuration Release - - - name: Push to NuGet - run: dotnet nuget push **\*.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json