Skip to content

Commit

Permalink
test4release
Browse files Browse the repository at this point in the history
  • Loading branch information
RingoTC committed Mar 6, 2024
1 parent 45ef133 commit 682b8cc
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 23 deletions.
31 changes: 18 additions & 13 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,26 @@ jobs:
- name: Get channel information
id: get-channel
run: |
echo "Current branch: ${{ steps.branch-names.outputs.current_branch }}"
branch_name=${{ steps.branch-names.outputs.current_branch }}
content=$(cat .releaserc)

channel=$(echo "$content" | jq -r --arg branch "$branch_name" '.branches[] | select(.name | test("^" + $branch + "$")) | .channel')

echo "::set-output name=channel::$channel"
BRANCH_NAME="${{ steps.branch-names.outputs.current_branch }}"
content=$(<.releaserc)
branches=$(jq -r '.branches | keys[]' <<< "$content")
for branch in $branches; do
branch_name=$(jq -r ".branches[$branch].name" <<< "$content")
if [[ "$BRANCH_NAME" =~ $branch_name ]]; then
channel=$(jq -r ".branches[$branch].channel" <<< "$content")
echo "::set-output name=channel::$channel"
exit 0
fi
done
echo "No channel found for branch $BRANCH_NAME"
exit 1
shell: bash


- name: Get deploy token
id: resolver
run: |
case ${{ steps.get-channel.outputs.channel }} in
CHANNEL="${{ steps.get-channel.outputs.channel }}"
case "$CHANNEL" in
"rc")
echo "::set-output name=DIGITALOCEAN_TOKEN::${{ secrets.DIGITALOCEAN_PRODUCTION_TOKEN }}"
echo "::set-output name=CLUSTER_NAME::${{ secrets.PRODUCTION_CLUSTER_NAME }}"
Expand All @@ -56,7 +61,7 @@ jobs:
echo "::set-output name=CLUSTER_NAME::${{ secrets.TEST_CLUSTER_NAME }}"
;;
*)
echo "No token found for channel ${{ steps.get-channel.outputs.channel }}"
echo "No token found for channel $CHANNEL"
exit 1
;;
esac
Expand All @@ -69,7 +74,7 @@ jobs:
echo "Channel: ${{ steps.get-channel.outputs.channel }}"
echo "DIGITALOCEAN_TOKEN: ${{ steps.resolver.outputs.DIGITALOCEAN_TOKEN }}"
echo "CLUSTER_NAME: ${{ steps.resolver.outputs.CLUSTER_NAME }}"
# - name: Run kustomize
# run: (cd ./deployment/base && ../../kustomize edit set image greenstand/treetracker-query-api:${{ steps.package-version.outputs.current-version }} )
# working-directory: ${{ env.project-directory }}
Expand All @@ -84,4 +89,4 @@ jobs:

# - name: Update kubernetes resources
# run: kustomize build deployment/overlays/prod | kubectl apply -n webmap --wait -f -
# working-directory: ${{ env.project-directory }}
# working-directory: ${{ env.project-directory }}
6 changes: 3 additions & 3 deletions .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
"channel": "rc"
},
{
"name":"alpha/**",
"name":"alpha/*",
"channel": "alpha"
},
{
"name":"beta/**",
"name":"beta/*",
"channel": "beta"
},
{
"name":"rc/**",
"name":"rc/*",
"channel": "rc"
}
],
Expand Down
7 changes: 0 additions & 7 deletions test.sh

This file was deleted.

0 comments on commit 682b8cc

Please sign in to comment.