Skip to content

Commit 36a1e19

Browse files
author
4gac
committed
feat: auto-update docker tag in config.json
1 parent a45ada2 commit 36a1e19

File tree

3 files changed

+27
-101
lines changed

3 files changed

+27
-101
lines changed

.github/workflows/docker-publish.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ jobs:
4646
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
4747
fi
4848
49+
- name: Update config.json version
50+
run: chmod +x update_version.sh && ./update_version.sh ${{ env.tag }}
51+
4952
- name: Extract metadata (tags, labels) for Docker
5053
id: meta
5154
uses: docker/metadata-action@v4

local_build.sh

Lines changed: 0 additions & 101 deletions
This file was deleted.

update_version.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
# Check if an argument is provided
4+
if [ -z "$1" ]; then
5+
echo "No argument provided. Usage: ./update_version.sh <argument>"
6+
exit 1
7+
fi
8+
9+
# Check if the input is "latest"
10+
if [ "$1" == "latest" ]; then
11+
echo "Input is 'latest'. No changes made."
12+
exit 0
13+
fi
14+
15+
# Check if config.json exists
16+
if [ ! -f "config.json" ]; then
17+
echo "File config.json does not exist."
18+
exit 1
19+
fi
20+
21+
# Replace "latest" with the provided argument in config.json
22+
sed -i "s/latest/$1/g" config.json
23+
24+
echo "Replaced all occurrences of 'latest' with '$1' in config.json."

0 commit comments

Comments
 (0)