Skip to content

Commit 9f5c6a1

Browse files
authored
Read VERSION file contents when bumping version (#16)
Signed-off-by: Andy Bavier <andybavier@gmail.com>
1 parent 8fd75c8 commit 9f5c6a1

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

.github/workflows/bump-version.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
# SPDX-FileCopyrightText: 2025 Intel Corporation
33
# SPDX-License-Identifier: Apache-2.0
44
name: Bump Version
5-
# Calling workflow should include "secrets: inherit"
5+
# Reads the contents of the VERSION file, increments the patch version,
6+
# appends '-dev' suffix, writes it back to the VERSION file, and creates a
7+
# pull request with the updated VERSION file.
8+
# Assumes that the VERSION file is in the format: MAJOR.MINOR.PATCH
9+
# Example: 1.2.3 -> 1.2.4-dev
10+
# The calling workflow should include "secrets: inherit" to pass the GITHUB_TOKEN.
611

712
on:
813
workflow_call:
9-
inputs:
10-
version:
11-
required: true
12-
type: string
1314

1415
jobs:
1516
bump-version:
@@ -20,7 +21,7 @@ jobs:
2021
fetch-depth: 0
2122
- name: increment version
2223
run: |
23-
IFS='.' read -r major minor patch <<< ${{ inputs.version }}
24+
IFS='.' read -r major minor patch <<< $(cat VERSION)
2425
patch_update=$((patch+1))
2526
NEW_VERSION="$major.$minor.$patch_update-dev"
2627
echo $NEW_VERSION > VERSION
@@ -29,7 +30,7 @@ jobs:
2930
- name: Create Pull Request
3031
uses: peter-evans/create-pull-request@v7
3132
with:
32-
token: ${{ secrets.GH_ONOS_PAT }}
33+
token: ${{ secrets.GITHUB_TOKEN }}
3334
commit-message: Update version
3435
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
3536
signoff: true

0 commit comments

Comments
 (0)