-
Notifications
You must be signed in to change notification settings - Fork 30
Add auto-tag daily version bump workflow #372
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鈥檒l 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 |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| { | ||
| "permissions": { | ||
| "allow": [ | ||
| "Read", | ||
| "Glob", | ||
| "Grep", | ||
| "Edit", | ||
| "Write", | ||
| "NotebookEdit", | ||
| "WebFetch", | ||
| "WebSearch", | ||
|
|
||
| "Bash(git status*)", | ||
| "Bash(git diff*)", | ||
| "Bash(git log*)", | ||
| "Bash(git show*)", | ||
| "Bash(git branch*)", | ||
| "Bash(git fetch*)", | ||
| "Bash(git rebase*)", | ||
| "Bash(git apply*)", | ||
| "Bash(git worktree*)", | ||
| "Bash(git show-branch*)", | ||
| "Bash(git tag*)", | ||
| "Bash(git stash*)", | ||
| "Bash(git checkout*)", | ||
| "Bash(git add*)", | ||
| "Bash(git commit*)", | ||
| "Bash(git rev-parse*)", | ||
| "Bash(git merge-base*)", | ||
| "Bash(gh *)", | ||
|
|
||
| "Bash(./setup_workspace.sh*)", | ||
| "Bash(./apply_patches.sh*)", | ||
| "Bash(./build_all.sh*)", | ||
| "Bash(make *)", | ||
|
|
||
| "Bash(./scripts/deploy_kernel*)", | ||
| "Bash(ssh *)", | ||
| "Bash(scp *)", | ||
|
|
||
| "Bash(python3 *)", | ||
| "Bash(pytest *)", | ||
| "Bash(python3 test/*)", | ||
|
|
||
| "Bash(cppcheck *)", | ||
|
|
||
| "Bash(ls *)", | ||
| "Bash(find *)", | ||
| "Bash(grep *)", | ||
| "Bash(cat *)", | ||
| "Bash(head *)", | ||
| "Bash(tail *)", | ||
| "Bash(wc *)", | ||
| "Bash(diff *)", | ||
| "Bash(file *)", | ||
| "Bash(realpath *)", | ||
| "Bash(nproc*)", | ||
| "Bash(which *)", | ||
| "Bash(tee *)", | ||
| "Bash(mkdir *)", | ||
| "Bash(cp *)", | ||
| "Bash(mv *)", | ||
| "Bash(ln *)", | ||
| "Bash(tar *)", | ||
| "Bash(wget *)", | ||
| "Bash(curl *)", | ||
|
|
||
| "Bash(v4l2-ctl *)", | ||
| "Bash(media-ctl *)", | ||
| "Bash(lsmod*)", | ||
| "Bash(dmesg*)", | ||
| "Bash(sudo dmesg*)", | ||
| "Bash(uname *)" | ||
| ], | ||
| "deny": [ | ||
| "Bash(git push --force*)", | ||
| "Bash(git reset --hard*)", | ||
| "Bash(git clean -f*)", | ||
| "Bash(rm -rf /*)" | ||
| ] | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,143 @@ | ||||||||||||||||||||||||
| name: Auto-Tag Daily Version Bump | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||
| schedule: | ||||||||||||||||||||||||
| - cron: '0 14 * * *' | ||||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||
| contents: write | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||
| bump-version: | ||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||
| - name: Checkout dev | ||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||
|
Comment on lines
+15
to
+17
|
||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||
| ref: dev | ||||||||||||||||||||||||
| fetch-depth: 0 | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Branch guard | ||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||
| branch=$(git rev-parse --abbrev-ref HEAD) | ||||||||||||||||||||||||
| if [ "$branch" != "dev" ]; then | ||||||||||||||||||||||||
| echo "::error::Expected branch 'dev', got '$branch'" | ||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Find latest tag | ||||||||||||||||||||||||
| id: latest_tag | ||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||
| tag=$(git tag --merged HEAD --sort=-v:refname | grep -E '^v[0-9]+\.' | head -1) | ||||||||||||||||||||||||
| if [ -z "$tag" ]; then | ||||||||||||||||||||||||
| echo "::error::No version tags found on dev. Create an initial tag manually (e.g., git tag -a v1.0.2.10 -m 'Initial tag')." | ||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||
| echo "tag=$tag" >> "$GITHUB_OUTPUT" | ||||||||||||||||||||||||
| echo "Found latest tag: $tag" | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Check for meaningful changes | ||||||||||||||||||||||||
| id: changes | ||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||
| tag="${{ steps.latest_tag.outputs.tag }}" | ||||||||||||||||||||||||
| changed=$(git diff --name-only "$tag"..HEAD) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if [ -z "$changed" ]; then | ||||||||||||||||||||||||
| echo "No changes since $tag" | ||||||||||||||||||||||||
| echo "has_changes=false" >> "$GITHUB_OUTPUT" | ||||||||||||||||||||||||
| exit 0 | ||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # Filter out ignored paths | ||||||||||||||||||||||||
| meaningful=$(echo "$changed" | grep -v -E '^(\.claude/|\.github/|test/|docs/)' || true) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if [ -z "$meaningful" ]; then | ||||||||||||||||||||||||
| echo "Only ignored-folder changes since $tag:" | ||||||||||||||||||||||||
| echo "$changed" | ||||||||||||||||||||||||
| echo "has_changes=false" >> "$GITHUB_OUTPUT" | ||||||||||||||||||||||||
| else | ||||||||||||||||||||||||
| echo "Meaningful changes since $tag:" | ||||||||||||||||||||||||
| echo "$meaningful" | ||||||||||||||||||||||||
| echo "has_changes=true" >> "$GITHUB_OUTPUT" | ||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Parse current version | ||||||||||||||||||||||||
| if: steps.changes.outputs.has_changes == 'true' | ||||||||||||||||||||||||
| id: version | ||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||
| current=$(grep -oP 'MODULE_VERSION\("\K[^"]+' kernel/realsense/d4xx.c) | ||||||||||||||||||||||||
| if [ -z "$current" ]; then | ||||||||||||||||||||||||
| echo "::error::Could not parse MODULE_VERSION from d4xx.c" | ||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||
| echo "current=$current" >> "$GITHUB_OUTPUT" | ||||||||||||||||||||||||
| echo "Current version: $current" | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| - name: Increment build number | ||||||||||||||||||||||||
| if: steps.changes.outputs.has_changes == 'true' | ||||||||||||||||||||||||
| id: bump | ||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||
| current="${{ steps.version.outputs.current }}" | ||||||||||||||||||||||||
| IFS='.' read -r major minor patch build <<< "$current" | ||||||||||||||||||||||||
| new_build=$((build + 1)) | ||||||||||||||||||||||||
|
Comment on lines
+83
to
+84
|
||||||||||||||||||||||||
| IFS='.' read -r major minor patch build <<< "$current" | |
| new_build=$((build + 1)) | |
| if [[ ! "$current" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then | |
| echo "::error::Unsupported MODULE_VERSION format '$current'. Expected 'X.Y.Z.BUILD' with numeric components." | |
| exit 1 | |
| fi | |
| major="${BASH_REMATCH[1]}" | |
| minor="${BASH_REMATCH[2]}" | |
| patch="${BASH_REMATCH[3]}" | |
| build="${BASH_REMATCH[4]}" | |
| new_build=$((10#$build + 1)) |
Copilot
AI
Feb 20, 2026
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.
Commit and tag are pushed in separate steps. If the commit push succeeds but the tag push fails, dev is bumped without a corresponding tag and reruns can keep bumping again. Consider pushing commit+tag together (e.g., git push --follow-tags) and failing the job if either ref can鈥檛 be pushed.
| - name: Push commit | |
| if: steps.changes.outputs.has_changes == 'true' | |
| run: git push origin dev | |
| - name: Push tag | |
| if: steps.changes.outputs.has_changes == 'true' | |
| run: git push origin "${{ steps.bump.outputs.new_tag }}" | |
| - name: Push commit and tag | |
| if: steps.changes.outputs.has_changes == 'true' | |
| run: git push --follow-tags origin dev |
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 can run on both
scheduleandworkflow_dispatch, but there is noconcurrencyguard. Overlapping runs can race (both compute the same next version/tag) and cause push/tag failures or inconsistent bumps. Add workflow/job-levelconcurrency(e.g., grouped by workflow name +dev) to ensure only one bump runs at a time.