diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 56f9498..6690ffe 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -23,7 +23,8 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 + - name: Checkout code + uses: actions/checkout@v6 with: fetch-depth: 0 @@ -32,19 +33,17 @@ jobs: with: dotnet-version: ${{ env.DOTNET_VERSION }} cache: true - cache-dependency-path: "**/packages.lock.json" - - - name: Restore dependencies - run: dotnet restore --locked-mode + cache-dependency-path: '**/packages.lock.json' - name: Install GitVersion uses: gittools/actions/gitversion/setup@v4.5.0 - name: Determine Version - id: gitversion + id: meta uses: gittools/actions/gitversion/execute@v4.5.0 - with: - updateProjectFiles: true + + - name: Restore dependencies + run: dotnet restore --locked-mode - name: Build run: dotnet build --no-restore -c Release @@ -55,6 +54,6 @@ jobs: - name: Upload Nuget package as Artifact uses: actions/upload-artifact@v6 with: - name: ${{ env.NUGET_PACKAGE_NAME }}.${{ steps.gitversion.outputs.FullSemVer }} + name: ${{ env.NUGET_PACKAGE_NAME }}.${{ steps.meta.outputs.SemVer }} path: ./artifacts/package/release/*nupkg retention-days: 1 diff --git a/.github/workflows/release-nuget.yml b/.github/workflows/release-nuget.yml index b793012..ebcad0f 100644 --- a/.github/workflows/release-nuget.yml +++ b/.github/workflows/release-nuget.yml @@ -1,6 +1,7 @@ name: 🎁 Publish nuget package on: + workflow_dispatch: push: tags: - "v[0-9]*.[0-9]*.[0-9]*" # Pattern for standard: v1.2.3 @@ -14,7 +15,7 @@ permissions: pull-requests: read jobs: - publish: + release: runs-on: ubuntu-latest environment: public-release @@ -31,17 +32,15 @@ jobs: cache: true cache-dependency-path: '**/packages.lock.json' - - name: Restore dependencies - run: dotnet restore --locked-mode - - name: Install GitVersion uses: gittools/actions/gitversion/setup@v4.5.0 - name: Determine Version - id: gitversion + id: meta uses: gittools/actions/gitversion/execute@v4.5.0 - with: - updateProjectFiles: true + + - name: Restore dependencies + run: dotnet restore --locked-mode - name: Build run: dotnet build --no-restore -c Release @@ -55,11 +54,12 @@ jobs: NUGET_AUTH_TOKEN: ${{ secrets.NUGET_TOKEN }} - name: Create Release - id: create_release uses: softprops/action-gh-release@v3 with: - tag_name: ${{ github.ref_name }} - name: "${{ github.ref_name }}" + tag_name: ${{ github.ref_type == 'tag' && github.ref_name || format('v{0}', steps.meta.outputs.SemVer) }} + name: ${{ github.ref_type == 'tag' && github.ref_name || format('v{0}', steps.meta.outputs.SemVer) }} generate_release_notes: true - files: ./artifacts/package/release/*nupkg - prerelease: ${{ steps.gitversion.outputs.PreReleaseTag != '' }} + target_commitish: ${{ github.sha }} + draft: false + prerelease: ${{ steps.meta.outputs.PreReleaseTag != '' }} + make_latest: ${{ steps.meta.outputs.PreReleaseTag == '' }} diff --git a/GitVersion.yaml b/GitVersion.yaml index e611680..bf21a15 100644 --- a/GitVersion.yaml +++ b/GitVersion.yaml @@ -1,5 +1,10 @@ workflow: GitHubFlow/v1 mode: ContinuousDelivery branches: + main: + label: "beta" feature: mode: ContinuousDelivery +assembly-versioning-format: '{MajorMinorPatch}.{WeightedPreReleaseNumber}' +assembly-file-versioning-format: '{MajorMinorPatch}.{WeightedPreReleaseNumber}' +assembly-informational-format: '{MajorMinorPatch}.{WeightedPreReleaseNumber}' \ No newline at end of file