Created
January 17, 2023 23:07
-
-
Save cmwylie19/7637ee22f5bc576e7d68398f5804ef3c to your computer and use it in GitHub Desktop.
Update semantic image version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| a=$(cat env/overlays/stage/version.yml | egrep "image: docker.io/cmwylie19" | sed 's/image: docker.io\/cmwylie19\/kubefs://g' | awk '{$1=$1};1') | |
| MINOR=$(echo ${a##*.}) | |
| MINOR=$(expr $MINOR + 1) | |
| # Patch Version | |
| IMAGE=$(cat env/overlays/stage/version.yml | egrep image: | sed 's/image: //g' | awk '{$1=$1};1') | |
| # Insert backslashes infront of forward slash | |
| NEW_IMAGE=$(echo ${IMAGE%?}$MINOR) | |
| # Insert backslash | |
| NEW_IMAGE=$(echo "$NEW_IMAGE" | sed 's#/#\\/#g') | |
| IMAGE=$(echo "$IMAGE" | sed 's#/#\\/#g') | |
| sed "s/$IMAGE/$NEW_IMAGE/g" env/overlays/stage/version.yml | |
| # Replace over whole app, ex below | |
| # For example to replace 'foo' with 'bar' - sed -i 's/foo/bar/g' input_file | |
| #- name: Replace credentials | |
| # run: | | |
| # find . -name "*" -exec sed -i "s/__VERSION__/$(cat VERSION.md)/g" {} + | |
| # sed -i 's/__DB-PASSWORD__/${{ secrets.DB_PASSWORD }}/g' db_connection.php | |
| # |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment