Skip to content

Commit

Permalink
Test trigger of branches query
Browse files Browse the repository at this point in the history
  • Loading branch information
sshrihar committed Sep 18, 2024
1 parent f482f6e commit f151eba
Showing 1 changed file with 43 additions and 29 deletions.
72 changes: 43 additions & 29 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,35 +27,49 @@ jobs:
with:
python-version: '3.11'

- name: Install pipenv
run: pip install pipenv

- name: Build Site
- name: List branches matching pattern
run: |
python build_branches.py '*kmurphy*'
branches=$(git branch -r --list "*kmurphy*" | grep -v '\->')
echo "Matching branches: $branches"
- name: Set Environment Variable
id: set-env-var
- name: Create folders and checkout branches
run: |
if [ "${{ inputs.environment }}" == "dev" ]; then
echo "ACCOUNT_NUMBER=058264511034" >> $GITHUB_OUTPUT
echo "APP_NAME=${{ inputs.core_app }}-dev" >> $GITHUB_OUTPUT
echo "CLUSTER_NAME=frontend-dev-ecs-cluster" >> $GITHUB_OUTPUT
elif [ "${{ inputs.environment }}" == "staging" ]; then
echo "ACCOUNT_NUMBER=070528468658" >> $GITHUB_OUTPUT
echo "APP_NAME=${{ inputs.core_app }}-staging" >> $GITHUB_OUTPUT
echo "CLUSTER_NAME=frontend-staging-ecs-cluster" >> $GITHUB_OUTPUT
fi
deploy:
uses: 0xPolygon/pipelines/.github/workflows/ecs_deploy_docker_taskdef.yaml@main
needs: set-env-variable
with:
app_name: ${{ needs.set-env-variable.outputs.APP_NAME }}
taskdef_file_vars: .github/assets/${{ inputs.environment }}-taskdef.yaml
aws_region: eu-west-1
environment: ${{ inputs.environment }}
cluster_name: ${{ needs.set-env-variable.outputs.CLUSTER_NAME }}
account_number: "${{ needs.set-env-variable.outputs.ACCOUNT_NUMBER }}"
docker_file: Dockerfile.review
secrets: inherit
for branch in $branches; do
branch_name=$(echo "$branch" | sed 's|origin/||')
mkdir -p branch/$branch_name
git checkout -b "$branch_name" --track "origin/$branch_name"
done
ls -lrt branch
# - name: Install pipenv
# run: pip install pipenv
#
# - name: Build Site
# run: |
# python build_branches.py '*kmurphy*'
#
# - name: Set Environment Variable
# id: set-env-var
# run: |
# if [ "${{ inputs.environment }}" == "dev" ]; then
# echo "ACCOUNT_NUMBER=058264511034" >> $GITHUB_OUTPUT
# echo "APP_NAME=${{ inputs.core_app }}-dev" >> $GITHUB_OUTPUT
# echo "CLUSTER_NAME=frontend-dev-ecs-cluster" >> $GITHUB_OUTPUT
# elif [ "${{ inputs.environment }}" == "staging" ]; then
# echo "ACCOUNT_NUMBER=070528468658" >> $GITHUB_OUTPUT
# echo "APP_NAME=${{ inputs.core_app }}-staging" >> $GITHUB_OUTPUT
# echo "CLUSTER_NAME=frontend-staging-ecs-cluster" >> $GITHUB_OUTPUT
# fi
#
# deploy:
# uses: 0xPolygon/pipelines/.github/workflows/ecs_deploy_docker_taskdef.yaml@main
# needs: set-env-variable
# with:
# app_name: ${{ needs.set-env-variable.outputs.APP_NAME }}
# taskdef_file_vars: .github/assets/${{ inputs.environment }}-taskdef.yaml
# aws_region: eu-west-1
# environment: ${{ inputs.environment }}
# cluster_name: ${{ needs.set-env-variable.outputs.CLUSTER_NAME }}
# account_number: "${{ needs.set-env-variable.outputs.ACCOUNT_NUMBER }}"
# docker_file: Dockerfile.review
# secrets: inherit

0 comments on commit f151eba

Please sign in to comment.