diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 2c7b15b..803fb1e 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -45,6 +45,8 @@ jobs: else echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV fi + - name: Update config.json version + run: chmod +x update_version.sh && ./update_version.sh ${{ env.tag }} - name: Extract metadata (tags, labels) for Docker id: meta diff --git a/update_version.sh b/update_version.sh new file mode 100644 index 0000000..a957e09 --- /dev/null +++ b/update_version.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Check if an argument is provided +if [ -z "$1" ]; then + echo "No argument provided. Usage: ./update_version.sh " + exit 1 +fi + +# Check if the input is "latest" +if [ "$1" == "latest" ]; then + echo "Input is 'latest'. No changes made." + exit 0 +fi + +# Check if config.json exists +if [ ! -f "config.json" ]; then + echo "File config.json does not exist." + exit 1 +fi + +# Replace "latest" with the provided argument in config.json +sed -i "s/latest/$1/g" config.json + +echo "Replaced all occurrences of 'latest' with '$1' in config.json."