diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index f8c3564..596e3ec 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -20,7 +20,7 @@ jobs: - name: Build Test run: dotnet build ProjBobcat/ProjBobcat.sln -c Release --no-restore publish-package: - name: Publish package + name: Publish PreRelease package runs-on: windows-latest needs: [test-build] if: needs.test-build.result == 'success' @@ -29,15 +29,18 @@ jobs: with: dotnet-version: 8.0 - uses: actions/checkout@v4 - - name: Get Current Time - id: current-time - uses: josStorer/get-current-time@v2.1.1 + - name: Get previous tag + id: previoustag + uses: "WyriHaximus/github-action-get-previous-tag@v1" with: - format: YYYYMMDD-HHmmss - utcOffset: "+08:00" + fallback: 0.0.0 + - name: Fix version tag + run: echo ::set-env name=PREVIOUS_TAG::${{ steps.previoustag.outputs.tag }} - name: Restore packages run: dotnet restore ProjBobcat/ProjBobcat.sln + - name: Build the project + run: dotnet build ProjBobcat/ProjBobcat.sln -c Release --no-restore - name: Create the package - run: dotnet pack ProjBobcat/ProjBobcat.sln -c Release -p:PackageVersion=beta-${{ steps.current-time.outputs.formattedTime }}-${{github.sha}}" + run: $tag="${{ steps.previoustag.outputs.tag }}".replace("v",""); dotnet pack ProjBobcat/ProjBobcat.sln -c Release -p:PackageVersion="$tag-(CI)${{ github.sha }}-beta" --no-build --no-restore - name: Publish the package to NuGet.org run: dotnet nuget push -k ${{secrets.NUGET_KEY}} -s https://api.nuget.org/v3/index.json "ProjBobcat/ProjBobcat/bin/Release/*.nupkg" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c36b550..3f0495d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: - name: Build Test run: dotnet build ProjBobcat/ProjBobcat.sln -c Release --no-restore publish-package: - name: Publish package + name: Publish Release package runs-on: windows-latest needs: [test-build] if: needs.test-build.result == 'success' @@ -31,7 +31,9 @@ jobs: - uses: actions/checkout@v4 - name: Restore packages run: dotnet restore ProjBobcat/ProjBobcat.sln + - name: Build the project + run: dotnet build ProjBobcat/ProjBobcat.sln -c Release --no-restore - name: Create the package - run: dotnet pack ProjBobcat/ProjBobcat.sln -c Release -p:PackageVersion=${{ github.ref }} + run: $tag=${{ github.ref }}.replace("v",""); dotnet pack ProjBobcat/ProjBobcat.sln -c Release -p:PackageVersion=$tag --no-build --no-restore - name: Publish the package to NuGet.org run: dotnet nuget push -k ${{secrets.NUGET_KEY}} -s https://api.nuget.org/v3/index.json "ProjBobcat/ProjBobcat/bin/Release/*.nupkg"