chore: update env_utils #142
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Analytics Service Template | |
env: | |
APPLICATION_NAME : "puente-analytics-service" | |
AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION : ${{ secrets.AWS_REGION }} | |
pAnalyticsDbName : ${{ secrets.pAnalyticsDbName }} | |
pAnalyticsDbUser : ${{ secrets.pAnalyticsDbUser }} | |
pAnalyticsDbPass : ${{ secrets.pAnalyticsDbPass }} | |
pAnalyticsDbHost : ${{ secrets.pAnalyticsDbHost }} | |
pAnalyticsDbHostDev : ${{ secrets.pAnalyticsDbHostDev }} | |
pAnalyticsDbPort : ${{ secrets.pAnalyticsDbPort }} | |
on: | |
push: | |
branches: | |
- master | |
- dev | |
jobs: | |
cloudformation-deployer: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Extract branch name | |
shell: bash | |
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
id: extract_branch | |
- name: Set environment variables | |
run: | | |
if [[ $GITHUB_REF == refs/heads/master ]]; then | |
echo "Setting environment variables for master branch" | |
export pAnalyticsDbName=pAnalyticsDbName | |
export pAnalyticsDbUser=pAnalyticsDbUser | |
export pAnalyticsDbPass=pAnalyticsDbPass | |
export pAnalyticsDbHost=pAnalyticsDbHost | |
export pAnalyticsDbPort=pAnalyticsDbPort | |
elif [[ $GITHUB_REF == refs/heads/dev ]]; then | |
echo "Setting environment variables for dev branch" | |
export pAnalyticsDbHost=pAnalyticsDbHostDev | |
else | |
echo "Branch not recognized, using default environment variables" | |
fi | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Run Script | |
run: | | |
sh puente-analytics-service/bin/deploy.sh -v -${{ steps.extract_branch.outputs.branch }} \ | |
-a ${{ env.AWS_ACCESS_KEY_ID }} \ | |
-b ${{ env.AWS_SECRET_ACCESS_KEY }} \ | |
-c ${{ env.AWS_REGION }} \ | |
-d ${{ env.pAnalyticsDbName }} \ | |
-e ${{ env.pAnalyticsDbUser }} \ | |
-f ${{ env.pAnalyticsDbPass }} \ | |
-f ${{ env.pAnalyticsDbHost }} \ | |
-f ${{ env.pAnalyticsDbPort }} |