ci: simplify with fresh clone each run
Some checks failed
Build & Deploy Go API / build (push) Failing after 16s
Some checks failed
Build & Deploy Go API / build (push) Failing after 16s
This commit is contained in:
@@ -17,14 +17,10 @@ jobs:
|
||||
- name: Clone + prepare
|
||||
run: |
|
||||
WORK=/root/.cache/demo-go-api
|
||||
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-go-api.git .
|
||||
fi
|
||||
rm -rf "$WORK"
|
||||
mkdir -p "$WORK"
|
||||
cd "$WORK"
|
||||
git clone http://joe:${GITEA_TOKEN}@192.168.1.212:3000/joe/demo-go-api.git .
|
||||
|
||||
- name: Login to Harbor
|
||||
run: docker login 192.168.1.212:1180 -u admin -p "$HARBOR_PASSWORD"
|
||||
@@ -48,22 +44,13 @@ jobs:
|
||||
|
||||
- name: Update image tag in values.yaml (commit-back GitOps)
|
||||
run: |
|
||||
set -e
|
||||
WORK=/root/.cache/demo-go-api
|
||||
cd $WORK
|
||||
cd /root/.cache/demo-go-api
|
||||
SHORT=${GITHUB_SHA::8}
|
||||
echo "Updating tag to ${SHORT}"
|
||||
sed -i "s/^ tag:.*/ tag: \"${SHORT}\"/" deploy/helm/values.yaml
|
||||
echo "--- diff ---"
|
||||
git diff deploy/helm/values.yaml || true
|
||||
git config user.email "ci@local"
|
||||
git config user.name "gitea-ci"
|
||||
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