@@ -32,21 +32,26 @@ jobs:
32
32
- name : Get channel information
33
33
id : get-channel
34
34
run : |
35
- echo "Current branch: ${{ steps.branch-names.outputs.current_branch }}"
36
- branch_name=${{ steps.branch-names.outputs.current_branch }}
37
-
38
- content=$(cat .releaserc)
39
-
40
- channel=$(echo "$content" | jq -r --arg branch "$branch_name" '.branches[] | select(.name | test("^" + $branch + "$")) | .channel')
41
-
42
- echo "::set-output name=channel::$channel"
35
+ BRANCH_NAME="${{ steps.branch-names.outputs.current_branch }}"
36
+ content=$(<.releaserc)
37
+ branches=$(jq -r '.branches | keys[]' <<< "$content")
38
+ for branch in $branches; do
39
+ branch_name=$(jq -r ".branches[$branch].name" <<< "$content")
40
+ if [[ "$BRANCH_NAME" =~ $branch_name ]]; then
41
+ channel=$(jq -r ".branches[$branch].channel" <<< "$content")
42
+ echo "::set-output name=channel::$channel"
43
+ exit 0
44
+ fi
45
+ done
46
+ echo "No channel found for branch $BRANCH_NAME"
47
+ exit 1
43
48
shell : bash
44
-
45
49
46
50
- name : Get deploy token
47
51
id : resolver
48
52
run : |
49
- case ${{ steps.get-channel.outputs.channel }} in
53
+ CHANNEL="${{ steps.get-channel.outputs.channel }}"
54
+ case "$CHANNEL" in
50
55
"rc")
51
56
echo "::set-output name=DIGITALOCEAN_TOKEN::${{ secrets.DIGITALOCEAN_PRODUCTION_TOKEN }}"
52
57
echo "::set-output name=CLUSTER_NAME::${{ secrets.PRODUCTION_CLUSTER_NAME }}"
56
61
echo "::set-output name=CLUSTER_NAME::${{ secrets.TEST_CLUSTER_NAME }}"
57
62
;;
58
63
*)
59
- echo "No token found for channel ${{ steps.get-channel.outputs.channel }} "
64
+ echo "No token found for channel $CHANNEL "
60
65
exit 1
61
66
;;
62
67
esac
69
74
echo "Channel: ${{ steps.get-channel.outputs.channel }}"
70
75
echo "DIGITALOCEAN_TOKEN: ${{ steps.resolver.outputs.DIGITALOCEAN_TOKEN }}"
71
76
echo "CLUSTER_NAME: ${{ steps.resolver.outputs.CLUSTER_NAME }}"
72
-
77
+
73
78
# - name: Run kustomize
74
79
# run: (cd ./deployment/base && ../../kustomize edit set image greenstand/treetracker-query-api:${{ steps.package-version.outputs.current-version }} )
75
80
# working-directory: ${{ env.project-directory }}
84
89
85
90
# - name: Update kubernetes resources
86
91
# run: kustomize build deployment/overlays/prod | kubectl apply -n webmap --wait -f -
87
- # working-directory: ${{ env.project-directory }}
92
+ # working-directory: ${{ env.project-directory }}
0 commit comments