Skip to content

Commit

Permalink
feat: add project version to repository (chainloop-dev#1463)
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Martinez <[email protected]>
  • Loading branch information
migmartri authored Nov 4, 2024
1 parent 3b3eb49 commit 408ced7
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .chainloop.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
projectVersion: v0.97.6

# Experimental feature used by Chainloop labs shared workflow https://github.com/chainloop-dev/labs
# It maps the material names with location in disk so they get automatically attested
docs:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build_and_package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ jobs:

- name: Bump Chart and Dagger Version
run: .github/workflows/utils/bump-chart-and-dagger-version.sh deployment/chainloop extras/dagger ${{ github.ref_name }}
- name: Bump Project Version
run: .github/workflows/utils/bump-project-version.sh ${{ github.ref_name }}

- name: Create Pull Request
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/utils/bump-project-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

# Bump the Chainloop project version to a specific version number in configFile (defult .chainloop.yml)

set -e

die () {
echo >&2 "$@"
echo "usage: bump-project-version.sh [version] [configFile]"
exit 1
}

## debug if desired
if [[ -n "${DEBUG}" ]]; then
set -x
fi

[ "$#" -ge 1 ] || die "At least 1 arguments required, $# provided"

version="${1}"
# append project path if provided

project_yaml=".chainloop.yml"
# manual override
if [[ -n "${2}" ]]; then
project_yaml="${2}"
fi

## Changes in .chainloop.yml
sed -i "s#^projectVersion:.*#projectVersion: ${version}#g" "${project_yaml}"

0 comments on commit 408ced7

Please sign in to comment.