ci: simplify with fresh clone each run
All checks were successful
Build & Deploy / build (push) Successful in 6s

This commit is contained in:
test
2026-07-19 21:01:22 +08:00
parent 9b212172db
commit 53deee5338

View File

@@ -18,14 +18,10 @@ jobs:
- name: Generate demo content + Dockerfile - name: Generate demo content + Dockerfile
run: | run: |
WORK=/root/.cache/demo-frontend WORK=/root/.cache/demo-frontend
mkdir -p $WORK rm -rf "$WORK"
cd $WORK mkdir -p "$WORK"
if [ -d .git ]; then cd "$WORK"
git reset --hard origin/main git clone http://joe:${GITEA_TOKEN}@192.168.1.212:3000/joe/demo-frontend.git .
git clean -fd
else
git clone http://joe:${GITEA_TOKEN}@192.168.1.212:3000/joe/demo-frontend.git .
fi
SHORT_SHA=${GITHUB_SHA::8} SHORT_SHA=${GITHUB_SHA::8}
cat > package.json <<EOF cat > package.json <<EOF
@@ -75,25 +71,13 @@ jobs:
- name: Update image tag in values.yaml (commit-back GitOps) - name: Update image tag in values.yaml (commit-back GitOps)
run: | run: |
set -e cd /root/.cache/demo-frontend
WORK=/root/.cache/demo-frontend
cd $WORK
SHORT=${GITHUB_SHA::8} SHORT=${GITHUB_SHA::8}
echo "Updating tag to ${SHORT}"
# Use sed to update image.tag in helm values.yaml
sed -i "s/^ tag:.*/ tag: \"${SHORT}\"/" deploy/helm/values.yaml sed -i "s/^ tag:.*/ tag: \"${SHORT}\"/" deploy/helm/values.yaml
echo "--- diff ---"
git diff deploy/helm/values.yaml || true
# Configure git
git config user.email "ci@local" git config user.email "ci@local"
git config user.name "gitea-ci" git config user.name "gitea-ci"
# Check if there are changes
if git diff --quiet deploy/helm/values.yaml; then
echo "No changes to commit"
exit 0
fi
git add deploy/helm/values.yaml git add deploy/helm/values.yaml
git commit -m "ci: update image tag to ${SHORT}" git commit -m "ci: update image tag to ${SHORT}" || echo "nothing to commit"
git push origin main git push origin main
echo "✓ Pushed tag ${SHORT}" echo "✓ Pushed tag ${SHORT}"
env: env: