Skip to content

Commit

Permalink
Fixed auto-tagging logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jstedfast committed Oct 15, 2024
1 parent e2e0185 commit 125a6b8
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,21 @@ jobs:
$xml = [xml](gc MailKit/MailKit.csproj)
$SEMANTIC_VERSION_NUMBER = $xml.Project.PropertyGroup.VersionPrefix
$VERSION_NUM = $SEMANTIC_VERSION_NUMBER[0].Trim()
Write-Host "version_num=${VERSION_NUM}"
Write-Host "version_tag=v${VERSION_NUM}"
[IO.File]::AppendAllText($env:GITHUB_OUTPUT, "version_num=${VERSION_NUM}$([Environment]::NewLine)")
[IO.File]::AppendAllText($env:GITHUB_OUTPUT, "version_tag=v${VERSION_NUM}$([Environment]::NewLine)")
- if: ${{ env.PUBLISH == 'true' }}
name: Get latest tag
id: get_latest_tag
shell: pwsh
run: |
$LATEST_TAG = git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' --tags "https://github.com/$env:GIT_URL.git" '*.*.*' | tail --lines=1 | cut --delimiter='/' --fields=3
Write-Host "tag=$LATEST_TAG"
[IO.File]::AppendAllText($env:GITHUB_OUTPUT, "tag=${LATEST_TAG}$([Environment]::NewLine)")
env:
GIT_URL: ${{ github.repository }}

- if: ${{ env.PUBLISH == 'true' && steps.semantic_version.outputs.version_tag != steps.get_latest_tag.outputs.tag }}
- if: ${{ env.PUBLISH == 'true' && steps.semantic_version.outputs.version_num != steps.get_latest_tag.outputs.tag }}
name: Add new tag to repo
id: add_new_tag_to_repo
continue-on-error: true
Expand Down

0 comments on commit 125a6b8

Please sign in to comment.