Skip to content

Commit 682b8cc

Browse files
committed
test4release
1 parent 45ef133 commit 682b8cc

File tree

3 files changed

+21
-23
lines changed

3 files changed

+21
-23
lines changed

.github/workflows/deploy.yml

+18-13
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,26 @@ jobs:
3232
- name: Get channel information
3333
id: get-channel
3434
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
4348
shell: bash
44-
4549

4650
- name: Get deploy token
4751
id: resolver
4852
run: |
49-
case ${{ steps.get-channel.outputs.channel }} in
53+
CHANNEL="${{ steps.get-channel.outputs.channel }}"
54+
case "$CHANNEL" in
5055
"rc")
5156
echo "::set-output name=DIGITALOCEAN_TOKEN::${{ secrets.DIGITALOCEAN_PRODUCTION_TOKEN }}"
5257
echo "::set-output name=CLUSTER_NAME::${{ secrets.PRODUCTION_CLUSTER_NAME }}"
@@ -56,7 +61,7 @@ jobs:
5661
echo "::set-output name=CLUSTER_NAME::${{ secrets.TEST_CLUSTER_NAME }}"
5762
;;
5863
*)
59-
echo "No token found for channel ${{ steps.get-channel.outputs.channel }}"
64+
echo "No token found for channel $CHANNEL"
6065
exit 1
6166
;;
6267
esac
@@ -69,7 +74,7 @@ jobs:
6974
echo "Channel: ${{ steps.get-channel.outputs.channel }}"
7075
echo "DIGITALOCEAN_TOKEN: ${{ steps.resolver.outputs.DIGITALOCEAN_TOKEN }}"
7176
echo "CLUSTER_NAME: ${{ steps.resolver.outputs.CLUSTER_NAME }}"
72-
77+
7378
# - name: Run kustomize
7479
# run: (cd ./deployment/base && ../../kustomize edit set image greenstand/treetracker-query-api:${{ steps.package-version.outputs.current-version }} )
7580
# working-directory: ${{ env.project-directory }}
@@ -84,4 +89,4 @@ jobs:
8489

8590
# - name: Update kubernetes resources
8691
# run: kustomize build deployment/overlays/prod | kubectl apply -n webmap --wait -f -
87-
# working-directory: ${{ env.project-directory }}
92+
# working-directory: ${{ env.project-directory }}

.releaserc

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
"channel": "rc"
66
},
77
{
8-
"name":"alpha/**",
8+
"name":"alpha/*",
99
"channel": "alpha"
1010
},
1111
{
12-
"name":"beta/**",
12+
"name":"beta/*",
1313
"channel": "beta"
1414
},
1515
{
16-
"name":"rc/**",
16+
"name":"rc/*",
1717
"channel": "rc"
1818
}
1919
],

test.sh

-7
This file was deleted.

0 commit comments

Comments
 (0)