Skip to content

Commit

Permalink
github action version check fix
Browse files Browse the repository at this point in the history
Signed-off-by: Woojoong Kim <[email protected]>
  • Loading branch information
woojoong88 committed Jul 1, 2024
1 parent 5b373d4 commit 710d59e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 26 deletions.
27 changes: 3 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,19 @@ on:

jobs:
version-check:
if: (github.repository_owner == 'onosproject')
runs-on: ubuntu-latest
outputs:
valid_version: ${{ steps.version-check-step.outputs.valid_version }}
dev_version: ${{ steps.dev-version-check-step.outputs.dev_version }}
target_version: ${{ steps.get-target-version-step.outputs.target_version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: chrisdickinson/setup-yq@latest
- name: check version
id: version-check-step
run: |
make check-version; if [[ $? == 0 ]]; then echo "valid_version=true" >> $GITHUB_OUTPUT; else echo "valid_version=false" >> $GITHUB_OUTPUT; fi
cat $GITHUB_OUTPUT
- name: check dev version
id: dev-version-check-step
run: |
f_dev=$(./build/bin/version_check.sh is_dev)
if [[ $f_dev == "true" ]]; then echo "dev_version=true" >> $GITHUB_OUTPUT; else echo "dev_version=false" >> $GITHUB_OUTPUT; fi
cat $GITHUB_OUTPUT
- name: get target version
id: get-target-version-step
run: |
echo "target_version=$(cat VERSION)" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
run: COMPARISON_BRANCH=${{ github.event.before }} make check-version

tag_versions:
runs-on: ubuntu-latest
needs: version-check
if: (github.repository_owner == 'onosproject') && (needs.version-check.outputs.valid_version == 'true') && (needs.version-check.outputs.dev_version == 'false')
if: github.repository_owner == 'onosproject'
steps:
- uses: actions/checkout@v4
with:
Expand Down
19 changes: 18 additions & 1 deletion build/bin/version_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,27 @@ function is_valid_format() {
return 0
}

function get_changed_charts() {
while IFS= read -r -d '' chart
do
chart_dir=$(dirname $chart)
chart_dir=$(basename $chart_dir)
chart_diff=$(git diff -p master --name-only ./$chart_dir)
if [ -n "$chart_diff" ]
then
echo $chart_dir
fi
done < <(find . -name Chart.yaml -print0)
}

function is_unique_version() {
echo "comparison branch $COMPARISON_BRANCH"

while IFS= read -r -d '' chart
do
chart_dir=$(dirname $chart)
chart_dir=$(basename $chart_dir)
chart_diff=$(git diff -p "$COMPARISON_BRANCH" -- "${chart_dir}/Chart.yaml")
chart_diff=$(git diff -p master --name-only ./$chart_dir)

if [ -n "$chart_diff" ]
then
Expand Down Expand Up @@ -55,6 +68,10 @@ case $INPUT in
is_unique_version
;;

get_changed_charts)
get_changed_charts
;;

*)
echo -n "unknown input"
exit 2
Expand Down
2 changes: 1 addition & 1 deletion onos-pci/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Default values for onos-pci`.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
# Declare variables to be passed into your templates.as

global:
image:
Expand Down

0 comments on commit 710d59e

Please sign in to comment.