Release v1.0.4: 버전 배지 및 자동화 개선 #2
Workflow file for this run
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: Update Package Version | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' # v1.0.0, v1.0.1 등의 태그가 푸시될 때 실행 | |
| jobs: | |
| update-version: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract version from tag | |
| id: get_version | |
| run: | | |
| # 태그 이름에서 'v' 제거하여 버전 추출 (예: v1.0.2 -> 1.0.2) | |
| VERSION=${GITHUB_REF#refs/tags/v} | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "📦 Extracted version: $VERSION" | |
| - name: Update package.json version | |
| run: | | |
| VERSION=${{ steps.get_version.outputs.version }} | |
| PACKAGE_FILE="src/UniFP/Assets/Plugins/UniFP/package.json" | |
| # jq를 사용하여 package.json의 version 필드 업데이트 | |
| jq --arg ver "$VERSION" '.version = $ver' "$PACKAGE_FILE" > tmp.json | |
| mv tmp.json "$PACKAGE_FILE" | |
| echo "✅ Updated package.json to version $VERSION" | |
| cat "$PACKAGE_FILE" | |
| - name: Check for changes | |
| id: check_changes | |
| run: | | |
| if git diff --quiet; then | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| echo "ℹ️ No changes detected" | |
| else | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| echo "📝 Changes detected" | |
| fi | |
| - name: Commit and push changes | |
| if: steps.check_changes.outputs.changed == 'true' | |
| run: | | |
| VERSION=${{ steps.get_version.outputs.version }} | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add src/UniFP/Assets/Plugins/UniFP/package.json | |
| git commit -m "chore: update package.json version to $VERSION [skip ci]" | |
| git push origin HEAD:main | |
| echo "✅ Changes committed and pushed" | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ steps.get_version.outputs.version }} | |
| name: Release v${{ steps.get_version.outputs.version }} | |
| body: | | |
| ## UniFP v${{ steps.get_version.outputs.version }} | |
| ### 변경사항 | |
| 자세한 변경사항은 [커밋 히스토리](https://github.com/${{ github.repository }}/commits/v${{ steps.get_version.outputs.version }})를 확인해주세요. | |
| ### 설치 방법 | |
| Unity Package Manager에서 다음 URL을 사용하여 설치: | |
| ``` | |
| https://github.com/${{ github.repository }}.git?path=src/UniFP/Assets/Plugins/UniFP#v${{ steps.get_version.outputs.version }} | |
| ``` | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |