docs: add CHANGELOG (Keep a Changelog format) #13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build, Test, and Publish NuGet Package | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*' # 릴리스 태그(v<버전>) push 시에만 배포 | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| build-and-publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write # Trusted Publishing용 GitHub OIDC 토큰 발급 허용 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v7 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build --configuration Release --no-restore | |
| - name: Test | |
| run: dotnet test --configuration Release --no-build --verbosity normal | |
| - name: Pack | |
| run: dotnet pack --configuration Release --no-build --output ./nupkg | |
| # 배포 전 태그(v<버전>)와 csproj의 <Version>이 일치하는지 검증 | |
| - name: Verify tag matches csproj version | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| VERSION=$(grep -oPm1 '(?<=<Version>)[^<]+' src/OpenGJKSharp/OpenGJKSharp.csproj) | |
| TAG_VERSION="${GITHUB_REF_NAME#v}" | |
| if [ "$VERSION" != "$TAG_VERSION" ]; then | |
| echo "csproj version ($VERSION) does not match tag ($TAG_VERSION)" | |
| exit 1 | |
| fi | |
| # Trusted Publishing: OIDC 토큰을 1시간짜리 임시 API 키로 교환 | |
| # (nuget.org -> 계정 -> Trusted Publishing 정책 등록 필요) | |
| - name: NuGet login (OIDC -> temp API key) | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: NuGet/login@v1 | |
| id: login | |
| with: | |
| user: JaejoonHan # nuget.org 프로필명 | |
| - name: Publish to NuGet | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: dotnet nuget push ./nupkg/*.nupkg --api-key ${{ steps.login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate |