Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-backend-prd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
tags:
- 'v*'
repository_dispatch:
types: [release]
types: [prd]
Comment on lines 6 to +7
Copy link

Copilot AI Jan 23, 2026

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.

Copilot uses AI. Check for mistakes.

jobs:
build-backend-and-push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-backend-stg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
tags:
- 'v*'
repository_dispatch:
types: [release]
types: [stg]
Comment on lines 6 to +7
Copy link

Copilot AI Jan 23, 2026

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.

Copilot uses AI. Check for mistakes.

jobs:
build-backend-and-push:
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/build-ext-prd.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
name: build chrome extension for prd

on:
workflow_run:
workflows:
- 'Bump Version'
types:
- completed
repository_dispatch:
types: [prd]

jobs:
build-chrome-extension:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/build-ext-stg.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
name: build chrome extension for stg

on:
workflow_run:
workflows:
- 'Bump Version'
types:
- completed
repository_dispatch:
types: [stg]

jobs:
build-chrome-extension:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down
44 changes: 36 additions & 8 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- develop

jobs:
bump-version:
Expand All @@ -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
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main branch version bumping logic only handles cases where there are at least 2 version parts. If the version has only 1 part (e.g., 'v1'), no bumping occurs and the version remains unchanged. Consider adding an else clause to handle this edge case or ensuring that versions always have at least 3 parts (major.minor.patch).

Copilot uses AI. Check for mistakes.

# Reassemble
new_version="${parts[0]}"
for i in $(seq 1 $last_index); do
for i in $(seq 1 $((${#parts[@]} - 1))); do
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version reassembly logic has an edge case issue. If the version has only one part (e.g., 'v1'), the seq command will receive 'seq 1 0' which produces no output, resulting in 'new_version' being just the major version without any dots or additional parts. Consider adding a check for the number of version parts or using a different approach to reassemble the version string.

Suggested change
for i in $(seq 1 $((${#parts[@]} - 1))); do
for ((i=1; i<${#parts[@]}; i++)); do

Copilot uses AI. Check for mistakes.
new_version="${new_version}.${parts[$i]}"
done

new_tag="v${new_version}"
echo "Branch: $branch"
echo "Bumped tag: $new_tag"
echo "new_tag=$new_tag" >> $GITHUB_OUTPUT

Expand All @@ -53,10 +71,20 @@ jobs:
git tag "${{ steps.bump.outputs.new_tag }}"
git push origin "${{ steps.bump.outputs.new_tag }}"

- name: Repository Dispatch
- name: Repository Dispatch (main -> prd)
if: github.ref_name == 'main'
uses: peter-evans/repository-dispatch@v4
with:
token: ${{ secrets.GH_PAT }}
repository: PaperDebugger/paperdebugger
event-type: release
client-payload: '{"tag": "${{ steps.bump.outputs.new_tag }}"}'
event-type: prd
client-payload: '{"tag": "${{ steps.bump.outputs.new_tag }}", "branch": "${{ github.ref_name }}"}'

- name: Repository Dispatch (develop -> stg)
if: github.ref_name == 'develop'
uses: peter-evans/repository-dispatch@v4
with:
token: ${{ secrets.GH_PAT }}
repository: PaperDebugger/paperdebugger
event-type: stg
client-payload: '{"tag": "${{ steps.bump.outputs.new_tag }}", "branch": "${{ github.ref_name }}"}'