Skip to content

Commit 0e3e8b0

Browse files
authored
chore: update chainloop.yaml method (#2542)
Signed-off-by: Miguel Martinez <[email protected]>
1 parent da610ad commit 0e3e8b0

File tree

3 files changed

+14
-30
lines changed

3 files changed

+14
-30
lines changed

.chainloop.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# This can indicate the next version and by default it will be marked as pre-release
2-
projectVersion: v1.56.0
1+
# This indicates the [current version]+next
2+
# to indicate that we are building a new version of the project
3+
projectVersion: v1.55.0+next
34

45
# Experimental feature used by Chainloop labs shared workflow https://github.com/chainloop-dev/labs
56
# It maps the material names with location in disk so they get automatically attested

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ jobs:
164164
- name: Bump Chart and Dagger Version
165165
run: .github/workflows/utils/bump-chart-and-dagger-version.sh deployment/chainloop extras/dagger ${{ github.ref_name }}
166166
- name: Bump Project Version
167-
run: .github/workflows/utils/bump-project-version.sh
167+
run: .github/workflows/utils/bump-project-version.sh ${{ github.ref_name }}
168168

169169
- name: Create Pull Request
170170
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2
Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/usr/bin/env bash
22

3-
# Bump the Chainloop project version to the next minor version to the version defined .chainloop.yml
3+
# Update the Chainloop project version in .chainloop.yml to the provided version + "+next"
44

55
set -e
66

77
die () {
88
echo >&2 "$@"
9-
echo "usage: bump-project-version.sh [configFile]"
9+
echo "usage: bump-project-version.sh <version> [configFile]"
1010
exit 1
1111
}
1212

@@ -15,35 +15,18 @@ if [[ -n "${DEBUG}" ]]; then
1515
set -x
1616
fi
1717

18+
[ "$#" -ge 1 ] || die "Version argument is required"
19+
20+
version="${1}"
1821
project_yaml=".chainloop.yml"
1922
# manual override
20-
if [[ -n "${1}" ]]; then
21-
project_yaml="${1}"
23+
if [[ -n "${2}" ]]; then
24+
project_yaml="${2}"
2225
fi
2326

24-
if [[ -n "$GITHUB_REF_NAME" ]]; then
25-
# Bump from provided version tag
26-
version=$(echo $GITHUB_REF_NAME | awk -F'[ .]' '{print $1"."$2+1"."0}')
27-
else
28-
# Load the previous version and bump appropriately
29-
version=$(cat "${project_yaml}" | awk '/^projectVersion:/ {
30-
version = $2;
31-
if (version ~ /-rc/) {
32-
# Handle release candidate versions (e.g., v1.0.0-rc.1 -> v1.0.0-rc.2)
33-
split(version, parts, /-rc\./);
34-
rc_num = parts[2] + 1;
35-
print parts[1] "-rc." rc_num;
36-
}
37-
else {
38-
# Load the previous version and BUMP THE MINOR
39-
# Handle minor version bumps (e.g., v1.0.0 -> v1.1.0)
40-
split(version, ver_parts, /\./);
41-
ver_parts[2] = ver_parts[2] + 1;
42-
print ver_parts[1] "." ver_parts[2] ".0";
43-
}
44-
}')
45-
fi
27+
# Append "+next" to the version
28+
version_with_next="${version}+next"
4629

4730
# Update the project yaml file
48-
sed -i "s#^projectVersion:.*#projectVersion: ${version}#g" "${project_yaml}"
31+
sed -i "s#^projectVersion:.*#projectVersion: ${version_with_next}#g" "${project_yaml}"
4932

0 commit comments

Comments
 (0)