Skip to content

Commit

Permalink
feat: auto-update docker tag in config.json
Browse files Browse the repository at this point in the history
  • Loading branch information
4gac committed Oct 8, 2024
1 parent 6dff599 commit 71f21ff
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ jobs:
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
uses: docker/metadata-action@v4
Expand Down
24 changes: 24 additions & 0 deletions update_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

# Check if an argument is provided
if [ -z "$1" ]; then
echo "No argument provided. Usage: ./update_version.sh <argument>"
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."

0 comments on commit 71f21ff

Please sign in to comment.