Pin Python to a patch version and auto-bump build version on container changes
CI / build-and-scan (push) Successful in 33s
CI / build-and-scan (push) Successful in 33s
This commit is contained in:
+30
-1
@@ -16,6 +16,7 @@ jobs:
|
|||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v7
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Build Docker image
|
- name: Build Docker image
|
||||||
run: |
|
run: |
|
||||||
@@ -81,13 +82,41 @@ jobs:
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
IMAGE=git.djeex.fr/djeex/adguard-cidre
|
if echo "$CHANGED" | grep -qE '^VERSION$'; then
|
||||||
|
echo "VERSION was manually edited in this push, using it as-is."
|
||||||
|
else
|
||||||
|
echo "VERSION untouched but container files changed, auto-bumping the build number (Z)."
|
||||||
|
OLD_VERSION=$(tr -d '[:space:]' < VERSION)
|
||||||
|
IFS='.' read -r MAJOR MINOR PATCH <<< "$OLD_VERSION"
|
||||||
|
NEW_VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))"
|
||||||
|
echo "$NEW_VERSION" > VERSION
|
||||||
|
|
||||||
|
git config user.name "adguard-cidre-ci"
|
||||||
|
git config user.email "[email protected]"
|
||||||
|
git add VERSION
|
||||||
|
git commit -m "Bump build version to $NEW_VERSION [skip ci]"
|
||||||
|
|
||||||
|
# Belt and suspenders: actions/checkout can leave its own ephemeral
|
||||||
|
# credential injected as an extraheader, which would silently override
|
||||||
|
# the URL-embedded token below. persist-credentials:false on checkout
|
||||||
|
# should already prevent this, but strip it here too just in case.
|
||||||
|
git config --unset-all http.https://git.djeex.fr/.extraheader || true
|
||||||
|
|
||||||
|
git push "https://Djeex:${{ secrets.CI_PUSH_TOKEN }}@git.djeex.fr/Djeex/adguard-cidre.git" HEAD:main
|
||||||
|
fi
|
||||||
|
|
||||||
VERSION=$(tr -d '[:space:]' < VERSION)
|
VERSION=$(tr -d '[:space:]' < VERSION)
|
||||||
|
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
|
||||||
|
MINOR_TAG="${MAJOR}.${MINOR}"
|
||||||
|
|
||||||
|
IMAGE=git.djeex.fr/djeex/adguard-cidre
|
||||||
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login git.djeex.fr -u Djeex --password-stdin
|
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login git.djeex.fr -u Djeex --password-stdin
|
||||||
|
|
||||||
# Retag the already-built, already-scanned image — never rebuild for publish,
|
# Retag the already-built, already-scanned image — never rebuild for publish,
|
||||||
# so what ships is byte-for-byte what Trivy just scanned.
|
# so what ships is byte-for-byte what Trivy just scanned.
|
||||||
docker tag adguard-cidre:ci "$IMAGE:latest"
|
docker tag adguard-cidre:ci "$IMAGE:latest"
|
||||||
|
docker tag adguard-cidre:ci "$IMAGE:$MINOR_TAG"
|
||||||
docker tag adguard-cidre:ci "$IMAGE:$VERSION"
|
docker tag adguard-cidre:ci "$IMAGE:$VERSION"
|
||||||
docker push "$IMAGE:latest"
|
docker push "$IMAGE:latest"
|
||||||
|
docker push "$IMAGE:$MINOR_TAG"
|
||||||
docker push "$IMAGE:$VERSION"
|
docker push "$IMAGE:$VERSION"
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
FROM python:3.14-alpine AS base
|
FROM python:3.14.7-alpine AS base
|
||||||
|
|
||||||
ENV TZ=Europe/Paris
|
ENV TZ=Europe/Paris
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user