1
0
mirror of https://github.com/rancher/rke.git synced 2025-06-25 23:12:30 +00:00
rke/scripts/dispatch
Chirayu Kapoor c357a2cb8a
Add support for v1.5 and branch release/v2.8
Signed-off-by: Chirayu Kapoor <chirayu.kapoor@suse.com>
2023-09-27 14:23:59 +05:30

29 lines
830 B
Bash
Executable File

#!/bin/bash
set -e
set -x
REPO="https://api.github.com/repos/rancher/rancher/actions/workflows/go-get.yml/dispatches"
case $DRONE_TAG in
"v1.4"*)
ACTION_TARGET_BRANCH="release/v2.7"
;;
"v1.5"*)
ACTION_TARGET_BRANCH="release/v2.8"
;;
*)
echo "Not a valid tag, not dispatching event"
exit 0
esac
echo "DRONE_TAG: $DRONE_TAG"
echo "DRONE_COMMIT_AUTHOR: $DRONE_COMMIT_AUTHOR"
echo "Dispatching to branch ${ACTION_TARGET_BRANCH}"
# send dispatch event to workflow
curl -XPOST -u "${PAT_USERNAME}:${PAT_TOKEN}" \
-H "Accept: application/vnd.github.v3+json" \
-H "Content-Type: application/json" $REPO \
--data '{"ref": "'"$ACTION_TARGET_BRANCH"'","inputs":{"goget_module":"github.com/rancher/rke","goget_version":"'"$DRONE_TAG"'","source_author":"'"$DRONE_COMMIT_AUTHOR"'"}}'