File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313 runs-on : ubuntu-latest
1414
1515 permissions :
16- contents : read
16+ contents : write # 릴리스 태그 push용
1717 id-token : write # Trusted Publishing용 GitHub OIDC 토큰 발급 허용
1818
1919 steps :
4949 - name : Publish to NuGet
5050 if : github.ref == 'refs/heads/main' # main 브랜치에서만 배포
5151 run : dotnet nuget push ./nupkg/*.nupkg --api-key ${{ steps.login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
52+
53+ # 배포된 버전에 릴리스 태그(v<버전>)를 자동으로 push (이미 있으면 스킵)
54+ - name : Tag release
55+ if : github.ref == 'refs/heads/main'
56+ run : |
57+ VERSION=$(grep -oPm1 '(?<=<Version>)[^<]+' src/OpenGJKSharp/OpenGJKSharp.csproj)
58+ if [ -z "$VERSION" ]; then
59+ echo "Version not found in csproj"; exit 1
60+ fi
61+ if git ls-remote --tags origin "refs/tags/v$VERSION" | grep -q .; then
62+ echo "Tag v$VERSION already exists, skipping"
63+ else
64+ git config user.name "github-actions[bot]"
65+ git config user.email "github-actions[bot]@users.noreply.github.com"
66+ git tag -a "v$VERSION" -m "Release v$VERSION"
67+ git push origin "v$VERSION"
68+ fi
You can’t perform that action at this time.
0 commit comments