From 42b8d23c0b11327ac35d6ba2348d6aee019dc962 Mon Sep 17 00:00:00 2001 From: dotnetprog <24593889+dotnetprog@users.noreply.github.com> Date: Thu, 28 Aug 2025 14:01:25 -0400 Subject: [PATCH] push to nuget step --- .github/workflows/ci-tag-release.yml | 9 +++- .github/workflows/tag-with-gitversion.yml | 53 ----------------------- 2 files changed, 8 insertions(+), 54 deletions(-) delete mode 100644 .github/workflows/tag-with-gitversion.yml diff --git a/.github/workflows/ci-tag-release.yml b/.github/workflows/ci-tag-release.yml index ac0f3c6..de79cc5 100644 --- a/.github/workflows/ci-tag-release.yml +++ b/.github/workflows/ci-tag-release.yml @@ -106,9 +106,14 @@ jobs: with: name: configurationmigrationtool_xrmtoolbox path: '${{ env.xtbpublishlocation }}' + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 8.0.x - name: zip artifact # This would actually build your project, using zip for an example artifact run: | zip -r configurationmigrationtool${{ github.ref_name }}.zip configurationmigrationtool + - name: Create Release id: create_release uses: actions/create-release@v1 @@ -126,7 +131,9 @@ jobs: FILENAME=$(basename "$NUPKG_PATH") echo "nupkg_path=$NUPKG_PATH" >> "$GITHUB_OUTPUT" echo "filename=$FILENAME" >> "$GITHUB_OUTPUT" # Make it available to subsequent steps - + - name: Push To NuGet Registry + run: | + dotnet nuget push ./xtb/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json - name: Upload NuGet Package Release Asset id: upload-nuget-release-asset uses: actions/upload-release-asset@v1 diff --git a/.github/workflows/tag-with-gitversion.yml b/.github/workflows/tag-with-gitversion.yml deleted file mode 100644 index 37c16e2..0000000 --- a/.github/workflows/tag-with-gitversion.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Tag with GitVersion - -on: - workflow_dispatch: - -permissions: - contents: write - -jobs: - tag: - name: Create tag from GitVersion - runs-on: ubuntu-latest - # additional safety to ensure this runs for main branch only - if: github.ref == 'refs/heads/main' - steps: - - name: Checkout repository (full history) - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v4.1.0 - with: - versionSpec: '6.3.x' - - name: Determine Version - id: gitversion # step id used as reference for output values - uses: gittools/actions/gitversion/execute@v4.1.0 - - - name: Create and push annotated tag (minor+1, patch=0) - env: - PERSONAL_ACCESS_TOKEN: ${{ secrets.GIST_AUTH_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - set -euo pipefail - MAJOR="${{ steps.gitversion.outputs.major }}" - MINOR="${{ steps.gitversion.outputs.minor }}" - # increment minor and set patch to 0 - NEW_MINOR=$((MINOR + 1)) - TAG="v${MAJOR}.${NEW_MINOR}.0" - echo "Computed tag: $TAG" - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - # create annotated tag (fail if exists) - git tag -a "$TAG" -m "Tag created by GitHub Actions using GitVersion (incremented minor)" - # choose token: use PAT if provided (recommended), otherwise fallback to GITHUB_TOKEN - TOKEN="${PERSONAL_ACCESS_TOKEN:-${GITHUB_TOKEN}}" - if [ -z "$TOKEN" ]; then - echo "No token available to push tag" - exit 1 - fi - # Push the tag using the chosen token over HTTPS to ensure it triggers other workflows - git push "https://x-access-token:${TOKEN}@github.com/${{ github.repository }}" "$TAG" -