-
Notifications
You must be signed in to change notification settings - Fork 0
ci : 릴리즈 브랜치가 유효한지 검사하는 ci 작성 #201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| name: Validate Release | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - 'release-*' | ||
|
|
||
| jobs: | ||
| validate-release: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout current branch | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Checkout main branch | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: main | ||
| path: main-branch | ||
|
|
||
| - name: Extract version from branch name | ||
| id: extract-version | ||
| env: | ||
| BRANCH_NAME: ${{ github.ref_name }} | ||
| run: | | ||
| VERSION="${BRANCH_NAME#release-}" | ||
| echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
| echo "Extracted version: $VERSION" | ||
|
|
||
| - name: Get current versionCode | ||
| id: current-version | ||
| run: | | ||
| CURRENT_VERSION_CODE=$(sed -nE 's/^[[:space:]]*versionCode[[:space:]]*=[[:space:]]*([0-9]+)[[:space:]]*$/\1/p' app/build.gradle.kts | head -n1) | ||
| [[ "$CURRENT_VERSION_CODE" =~ ^[0-9]+$ ]] || { echo "❌ Invalid current versionCode: $CURRENT_VERSION_CODE"; exit 1; } | ||
| echo "current_version_code=$CURRENT_VERSION_CODE" >> $GITHUB_OUTPUT | ||
| echo "Current versionCode: $CURRENT_VERSION_CODE" | ||
|
|
||
| - name: Get main branch versionCode | ||
| id: main-version | ||
| run: | | ||
| MAIN_VERSION_CODE=$(sed -nE 's/^[[:space:]]*versionCode[[:space:]]*=[[:space:]]*([0-9]+)[[:space:]]*$/\1/p' main-branch/app/build.gradle.kts | head -n1) | ||
| [[ "$MAIN_VERSION_CODE" =~ ^[0-9]+$ ]] || { echo "❌ Invalid main versionCode: $MAIN_VERSION_CODE"; exit 1; } | ||
| echo "main_version_code=$MAIN_VERSION_CODE" >> $GITHUB_OUTPUT | ||
| echo "Main branch versionCode: $MAIN_VERSION_CODE" | ||
|
|
||
| - name: Compare versionCode | ||
| run: | | ||
| CURRENT=${{ steps.current-version.outputs.current_version_code }} | ||
| MAIN=${{ steps.main-version.outputs.main_version_code }} | ||
|
|
||
| echo "Current versionCode: $CURRENT" | ||
| echo "Main versionCode: $MAIN" | ||
|
|
||
| if (( CURRENT <= MAIN )); then | ||
| echo "❌ Error: Current versionCode ($CURRENT) must be greater than main branch versionCode ($MAIN)" | ||
| exit 1 | ||
| else | ||
| echo "✅ versionCode validation passed: $CURRENT > $MAIN" | ||
| fi | ||
|
|
||
| - name: Check release note exists | ||
| run: | | ||
| VERSION="${{ steps.extract-version.outputs.version }}" | ||
| RELEASE_NOTE_PATH="docs/releaseNote/v$VERSION/release.md" | ||
|
|
||
| echo "Checking for release note at: $RELEASE_NOTE_PATH" | ||
|
|
||
| if [ ! -f "$RELEASE_NOTE_PATH" ]; then | ||
| echo "❌ Error: Release note not found at $RELEASE_NOTE_PATH" | ||
| echo "Please create a release note for version $VERSION" | ||
| exit 1 | ||
| else | ||
| echo "✅ Release note found at $RELEASE_NOTE_PATH" | ||
| echo "" | ||
| echo "Release note content:" | ||
| cat "$RELEASE_NOTE_PATH" | ||
| fi | ||
|
|
||
| - name: Validation Summary | ||
| if: success() | ||
| run: | | ||
| echo "🎉 All validations passed!" | ||
| echo "- Version: ${{ steps.extract-version.outputs.version }}" | ||
| echo "- versionCode: ${{ steps.current-version.outputs.current_version_code }} (main: ${{ steps.main-version.outputs.main_version_code }})" | ||
| echo "- Release note: ✅ exists" | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.