Skip to content

Commit

Permalink
Add validate github version
Browse files Browse the repository at this point in the history
  • Loading branch information
origamiofficial committed Mar 2, 2024
1 parent f0b12bd commit 6607c97
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/build-and-push-dispatch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,17 @@ jobs:
if: inputs.BaseImageTag == 'latest'
id: version_code_check_latest
run: |
function validate_version() {
local version="$1"
if [[ ! "$version" =~ ^[0-9]{4}\.[0-9]{2}\.[0-9]{1}$ ]]; then
echo "Error invalid version format: $version"
exit 1
fi
}
CHECK_VERSION_CODE=$(curl -s https://api.github.com/repos/pi-hole/docker-pi-hole/releases/latest | grep "name" | cut -d'"' -f 4 | tail -n 1)
echo "New Version: $CHECK_VERSION_CODE"
validate_version "$CHECK_VERSION_CODE"
echo VERSION_CODE=$CHECK_VERSION_CODE >> $GITHUB_OUTPUT
-
name: Version code [dev / development-v6]
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/build-and-push-latest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,17 @@ jobs:
name: Version code
id: version_code_check
run: |
function validate_version() {
local version="$1"
if [[ ! "$version" =~ ^[0-9]{4}\.[0-9]{2}\.[0-9]{1}$ ]]; then
echo "Error invalid version format: $version"
exit 1
fi
}
CHECK_VERSION_CODE=$(curl -s https://api.github.com/repos/pi-hole/docker-pi-hole/releases/latest | grep "name" | cut -d'"' -f 4 | tail -n 1)
echo "New Version: $CHECK_VERSION_CODE"
validate_version "$CHECK_VERSION_CODE"
echo VERSION_CODE=$CHECK_VERSION_CODE >> $GITHUB_OUTPUT
-
name: Set up QEMU
Expand Down

0 comments on commit 6607c97

Please sign in to comment.