ci: simplify with fresh clone each run
All checks were successful
Build & Deploy / build (push) Successful in 6s
All checks were successful
Build & Deploy / build (push) Successful in 6s
This commit is contained in:
@@ -18,14 +18,10 @@ jobs:
|
||||
- name: Generate demo content + Dockerfile
|
||||
run: |
|
||||
WORK=/root/.cache/demo-frontend
|
||||
mkdir -p $WORK
|
||||
cd $WORK
|
||||
if [ -d .git ]; then
|
||||
git reset --hard origin/main
|
||||
git clean -fd
|
||||
else
|
||||
git clone http://joe:${GITEA_TOKEN}@192.168.1.212:3000/joe/demo-frontend.git .
|
||||
fi
|
||||
rm -rf "$WORK"
|
||||
mkdir -p "$WORK"
|
||||
cd "$WORK"
|
||||
git clone http://joe:${GITEA_TOKEN}@192.168.1.212:3000/joe/demo-frontend.git .
|
||||
|
||||
SHORT_SHA=${GITHUB_SHA::8}
|
||||
cat > package.json <<EOF
|
||||
@@ -75,25 +71,13 @@ jobs:
|
||||
|
||||
- name: Update image tag in values.yaml (commit-back GitOps)
|
||||
run: |
|
||||
set -e
|
||||
WORK=/root/.cache/demo-frontend
|
||||
cd $WORK
|
||||
cd /root/.cache/demo-frontend
|
||||
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
|
||||
echo "--- diff ---"
|
||||
git diff deploy/helm/values.yaml || true
|
||||
# Configure git
|
||||
git config user.email "ci@local"
|
||||
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 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
|
||||
echo "✓ Pushed tag ${SHORT}"
|
||||
env:
|
||||
|
||||
Reference in New Issue
Block a user