.gitea/workflows/build-and-push.yaml aktualisiert
build-and-push.yaml / release-and-build (push) Failing after 23m21s
build-and-push.yaml / release-and-build (push) Failing after 23m21s
This commit is contained in:
1 parent
59d5de46f9
commit
453923d406
1 file changed
+72
-72
@@ -237,11 +237,11 @@ jobs:
|
|||||||
# 1. Authentifizierter Download der Templates
|
# 1. Authentifizierter Download der Templates
|
||||||
TOKEN="${{ secrets.RUNNER_TOKEN }}"
|
TOKEN="${{ secrets.RUNNER_TOKEN }}"
|
||||||
curl -sSLf -H "Authorization: token $TOKEN" \
|
curl -sSLf -H "Authorization: token $TOKEN" \
|
||||||
"https://git.pi-farm.de/pi-farm/templates/raw/branch/dev/README.template" \
|
"https://git.pi-farm.de/pi-farm/templates/raw/branch/main/README.template" \
|
||||||
-o README.template || echo "Warnung: README Template konnte nicht geladen werden"
|
-o README.template || echo "Warnung: README Template konnte nicht geladen werden"
|
||||||
|
|
||||||
curl -sSLf -H "Authorization: token $TOKEN" \
|
curl -sSLf -H "Authorization: token $TOKEN" \
|
||||||
"https://git.pi-farm.de/pi-farm/templates/raw/branch/dev/docker-compose.template" \
|
"https://git.pi-farm.de/pi-farm/templates/raw/branch/main/docker-compose.template" \
|
||||||
-o docker-compose.template || echo "Warnung: Compose Template konnte nicht geladen werden"
|
-o docker-compose.template || echo "Warnung: Compose Template konnte nicht geladen werden"
|
||||||
|
|
||||||
# 2. Sicherheitsprüfung auf HTML-Login-Seite
|
# 2. Sicherheitsprüfung auf HTML-Login-Seite
|
||||||
@@ -377,76 +377,76 @@ jobs:
|
|||||||
echo "EOF"
|
echo "EOF"
|
||||||
} >> $GITHUB_ENV
|
} >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Push README to Docker Hub
|
- name: Push README to Docker Hub
|
||||||
if: steps.check_changes.outputs.should_build == 'true' && contains(steps.prep.outputs.push_targets, 'dockerhub')
|
if: steps.check_changes.outputs.should_build == 'true' && contains(steps.prep.outputs.push_targets, 'dockerhub')
|
||||||
run: |
|
run: |
|
||||||
if ! command -v jq &> /dev/null; then
|
if ! command -v jq &> /dev/null; then
|
||||||
apt-get update && apt-get install -y jq || apk add --no-cache jq || true
|
apt-get update && apt-get install -y jq || apk add --no-cache jq || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "🚀 Starting update README on Docker Hub..."
|
echo "🚀 Starting update README on Docker Hub..."
|
||||||
|
|
||||||
TOKEN=$(curl -s -X POST "https://hub.docker.com/v2/users/login/" \
|
TOKEN=$(curl -s -X POST "https://hub.docker.com/v2/users/login/" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{\"username\": \"${{ secrets.DOCKERHUB_USERNAME }}\", \"password\": \"${{ secrets.DOCKERHUB_TOKEN }}\"}" | jq -r .token)
|
-d "{\"username\": \"${{ secrets.DOCKERHUB_USERNAME }}\", \"password\": \"${{ secrets.DOCKERHUB_TOKEN }}\"}" | jq -r .token)
|
||||||
|
|
||||||
if [ "$TOKEN" == "null" ] || [ -z "$TOKEN" ]; then
|
if [ "$TOKEN" == "null" ] || [ -z "$TOKEN" ]; then
|
||||||
echo "❌ Error: No login-token available. Check your credentials!"
|
echo "❌ Error: No login-token available. Check your credentials!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
REPO_PURE="${{ steps.prep.outputs.repo_pure }}"
|
REPO_PURE="${{ steps.prep.outputs.repo_pure }}"
|
||||||
DH_USER="${{ secrets.DOCKERHUB_USERNAME }}"
|
DH_USER="${{ secrets.DOCKERHUB_USERNAME }}"
|
||||||
|
|
||||||
SHORT_DESC=$(echo -e "${{ env.DESCRIPTION }}" | head -n 1 | cut -c 1-100)
|
SHORT_DESC=$(echo -e "${{ env.DESCRIPTION }}" | head -n 1 | cut -c 1-100)
|
||||||
[ -z "$SHORT_DESC" ] && SHORT_DESC="Docker Image for $REPO_PURE"
|
[ -z "$SHORT_DESC" ] && SHORT_DESC="Docker Image for $REPO_PURE"
|
||||||
|
|
||||||
echo "📦 Processing README.md (${REPO_PURE})..."
|
echo "📦 Processing README.md (${REPO_PURE})..."
|
||||||
|
|
||||||
jq -n \
|
jq -n \
|
||||||
--arg desc "$SHORT_DESC" \
|
--arg desc "$SHORT_DESC" \
|
||||||
--rawfile full_desc README.md \
|
--rawfile full_desc README.md \
|
||||||
'{description: $desc, full_description: $full_desc}' > payload.json
|
'{description: $desc, full_description: $full_desc}' > payload.json
|
||||||
|
|
||||||
echo "📤 Sending data to Docker Hub API..."
|
echo "📤 Sending data to Docker Hub API..."
|
||||||
RESPONSE=$(curl -s -w "\n%{http_code}" -X PATCH \
|
RESPONSE=$(curl -s -w "\n%{http_code}" -X PATCH \
|
||||||
"https://hub.docker.com/v2/repositories/${DH_USER}/${REPO_PURE}/" \
|
"https://hub.docker.com/v2/repositories/${DH_USER}/${REPO_PURE}/" \
|
||||||
-H "Authorization: JWT ${TOKEN}" \
|
-H "Authorization: JWT ${TOKEN}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d @payload.json)
|
-d @payload.json)
|
||||||
|
|
||||||
HTTP_STATUS=$(echo "$RESPONSE" | tail -n 1)
|
HTTP_STATUS=$(echo "$RESPONSE" | tail -n 1)
|
||||||
BODY=$(echo "$RESPONSE" | head -n -1)
|
BODY=$(echo "$RESPONSE" | head -n -1)
|
||||||
|
|
||||||
if [ "$HTTP_STATUS" -eq 200 ]; then
|
if [ "$HTTP_STATUS" -eq 200 ]; then
|
||||||
echo "✅ README update successfull (HTTP 200)."
|
echo "✅ README update successfull (HTTP 200)."
|
||||||
else
|
else
|
||||||
echo "❌ Error on update! HTTP Status: $HTTP_STATUS"
|
echo "❌ Error on update! HTTP Status: $HTTP_STATUS"
|
||||||
echo "Answer from Docker Hub: $BODY"
|
echo "Answer from Docker Hub: $BODY"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Commit, Tag and Push Changes
|
- name: Commit, Tag and Push Changes
|
||||||
if: steps.check_changes.outputs.should_build == 'true'
|
if: steps.check_changes.outputs.should_build == 'true'
|
||||||
run: |
|
run: |
|
||||||
git config --local user.email "action@pi-farm.de"
|
git config --local user.email "action@pi-farm.de"
|
||||||
git config --local user.name "Gitea Action"
|
git config --local user.name "Gitea Action"
|
||||||
|
|
||||||
git add VERSION.history README.md docker-compose.yml
|
git add VERSION.history README.md docker-compose.yml
|
||||||
|
|
||||||
git diff --quiet && git diff --staged --quiet || git commit -m "${{ env.FINAL_MSG }} [skip ci]"
|
git diff --quiet && git diff --staged --quiet || git commit -m "${{ env.FINAL_MSG }} [skip ci]"
|
||||||
|
|
||||||
TARGET_TAG="${{ steps.prep.outputs.docker_tag }}"
|
TARGET_TAG="${{ steps.prep.outputs.docker_tag }}"
|
||||||
git tag -f "$TARGET_TAG"
|
git tag -f "$TARGET_TAG"
|
||||||
|
|
||||||
if [[ "${{ gitea.ref }}" == refs/tags/* ]]; then
|
if [[ "${{ gitea.ref }}" == refs/tags/* ]]; then
|
||||||
echo "🏷️ Build aus Tag getriggert: $TARGET_TAG"
|
echo "🏷️ Build aus Tag getriggert: $TARGET_TAG"
|
||||||
git push -f origin "$TARGET_TAG"
|
git push -f origin "$TARGET_TAG"
|
||||||
else
|
else
|
||||||
echo "🌿 Build aus Branch/Schedule getriggert: ${{ gitea.ref_name }}"
|
echo "🌿 Build aus Branch/Schedule getriggert: ${{ gitea.ref_name }}"
|
||||||
git push origin HEAD:${{ gitea.ref_name }}
|
git push origin HEAD:${{ gitea.ref_name }}
|
||||||
git push -f origin "$TARGET_TAG"
|
git push -f origin "$TARGET_TAG"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Cleanup Temporary Tags on Docker Hub
|
- name: Cleanup Temporary Tags on Docker Hub
|
||||||
if: steps.check_changes.outputs.should_build == 'true' && contains(steps.prep.outputs.push_targets, 'dockerhub')
|
if: steps.check_changes.outputs.should_build == 'true' && contains(steps.prep.outputs.push_targets, 'dockerhub')
|
||||||
|
|||||||
Reference in new issue
Block a user