Commit 12fafc64 authored by Santhosh Nagaraj S's avatar Santhosh Nagaraj S
Browse files

ci: Fix gh action manual trigger error


This patch fixes the error that occurs
when manually triggering the homebrew and
minikube update PR. The fix deletes the PR
branches if it already exists to prevent
error.
Signed-off-by: default avatarSanthosh Nagaraj S <santhosh@kinvolk.io>
Showing with 19 additions and 1 deletion
+19 -1
......@@ -44,6 +44,7 @@ jobs:
repository: kinvolk/homebrew-cask
path: homebrew-cask
token: ${{ secrets. KINVOLK_REPOS_TOKEN }}
fetch-depth: 0
- name: Update headlamp version in homebrew-cask
run: |
user=${{github.actor}}
......@@ -51,6 +52,14 @@ jobs:
user=yolossn
fi
cd homebrew-cask
if git branch -l | grep -q "update_headlamp_$HEADLAMP_VERSION"; then
echo "deleting old branch from local to avoid conflict"
git branch -D "update_headlamp_$HEADLAMP_VERSION"
fi
if git branch -a | grep -q "origin/update_headlamp_$HEADLAMP_VERSION"; then
echo "deleting old branch from remote to avoid conflict"
git push origin --delete "update_headlamp_$HEADLAMP_VERSION"
fi
HEADLAMP_VERSION=${LATEST_HEADLAMP_TAG:1}
wget "https://github.com/kinvolk/headlamp/releases/download/$LATEST_HEADLAMP_TAG/checksums.txt"
ARM_SHA=$(cat checksums.txt | grep .arm64.dmg | awk -F" " '{print $1}')
......
......@@ -46,6 +46,7 @@ jobs:
repository: kinvolk/minikube
path: minikube
token: ${{ secrets. KINVOLK_REPOS_TOKEN }}
fetch-depth: 0
- name: Update headlamp version in minikube
run: |
user=${{github.actor}}
......@@ -56,7 +57,15 @@ jobs:
LATEST_HEADLAMP_SHA=$(gh api \
"/orgs/kinvolk/packages/container/headlamp/versions" --jq "map(select(.metadata.container.tags[] | contains(\"$LATEST_HEADLAMP_TAG\"))) | .[].name")
echo $LATEST_HEADLAMP_SHA
cd minikube
cd minikube
if git branch -l | grep -q "update_headlamp_$HEADLAMP_VERSION"; then
echo "deleting old branch from local to avoid conflict"
git branch -D "update_headlamp_$HEADLAMP_VERSION"
fi
if git branch -a | grep -q "origin/update_headlamp_$HEADLAMP_VERSION"; then
echo "deleting old branch from remote to avoid conflict"
git push origin --delete "update_headlamp_$HEADLAMP_VERSION"
fi
git checkout -b "update_headlamp_$HEADLAMP_VERSION"
sed -i "s/kinvolk\/headlamp:v.*/kinvolk\/headlamp:$LATEST_HEADLAMP_TAG@$LATEST_HEADLAMP_SHA\",/g" ./pkg/minikube/assets/addons.go
git diff
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment