-
Notifications
You must be signed in to change notification settings - Fork 67
feat: bump version for develop and main branch #95
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ on: | |
| tags: | ||
| - 'v*' | ||
| repository_dispatch: | ||
| types: [release] | ||
| types: [prd] | ||
|
|
||
| jobs: | ||
| build-backend-and-push: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ on: | |
| tags: | ||
| - 'v*' | ||
| repository_dispatch: | ||
| types: [release] | ||
| types: [stg] | ||
|
Comment on lines
6
to
+7
|
||
|
|
||
| jobs: | ||
| build-backend-and-push: | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,6 +4,7 @@ on: | |||||
| push: | ||||||
| branches: | ||||||
| - main | ||||||
| - develop | ||||||
|
|
||||||
| jobs: | ||||||
| bump-version: | ||||||
|
|
@@ -24,25 +25,42 @@ jobs: | |||||
| echo "Found tag: $tag" | ||||||
| echo "tag=$tag" >> $GITHUB_OUTPUT | ||||||
|
|
||||||
| - name: Bump patch version | ||||||
| - name: Bump version | ||||||
| id: bump | ||||||
| run: | | ||||||
| tag="${{ steps.get_tag.outputs.tag }}" | ||||||
| branch="${{ github.ref_name }}" | ||||||
| # Remove v prefix | ||||||
| version="${tag#v}" | ||||||
|
|
||||||
| # Use awk or bash logic to increment the last digit | ||||||
| # Parse version parts | ||||||
| IFS='.' read -r -a parts <<< "$version" | ||||||
| last_index=$((${#parts[@]} - 1)) | ||||||
| parts[$last_index]=$((parts[$last_index] + 1)) | ||||||
|
|
||||||
| if [ "$branch" = "develop" ]; then | ||||||
| # Develop branch: bump patch version (last value) | ||||||
| # v2.1.2 --> v2.1.3 | ||||||
| last_index=$((${#parts[@]} - 1)) | ||||||
| parts[$last_index]=$((parts[$last_index] + 1)) | ||||||
| elif [ "$branch" = "main" ]; then | ||||||
| # Main branch: bump minor version and set patch to 0 | ||||||
| # v2.1.2 --> v2.2.0 | ||||||
| if [ ${#parts[@]} -ge 2 ]; then | ||||||
| parts[1]=$((parts[1] + 1)) | ||||||
| # Set patch version to 0 | ||||||
| if [ ${#parts[@]} -ge 3 ]; then | ||||||
| parts[2]=0 | ||||||
| fi | ||||||
| fi | ||||||
| fi | ||||||
|
Comment on lines
+44
to
+54
|
||||||
|
|
||||||
| # Reassemble | ||||||
| new_version="${parts[0]}" | ||||||
| for i in $(seq 1 $last_index); do | ||||||
| for i in $(seq 1 $((${#parts[@]} - 1))); do | ||||||
|
||||||
| for i in $(seq 1 $((${#parts[@]} - 1))); do | |
| for ((i=1; i<${#parts[@]}; i++)); do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This workflow is now triggered by repository_dispatch with a tag in the client_payload, but the existing checkout step at line 19-20 (not shown in diff) doesn't specify a 'ref' parameter. This means it will checkout the default branch instead of the newly created tag. The checkout action needs to be updated to include 'ref: ${{ github.event.client_payload.tag }}' to checkout the correct tag version.