fix template cors #9
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: AWS CD | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- dev | |
jobs: | |
DeployToAWS: | |
environment: | |
name: ${{ github.ref_name }} | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-region: sa-east-1 | |
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/GithubActionsRole | |
role-session-name: github-action | |
- name: Setting stage and stack name | |
run: | | |
echo "STAGE=${{ github.ref_name }}" | |
PROJECT_NAME=$(echo ${{ github.event.repository.name }} | sed -e 's/[-_]/ /g' | awk '{for(i=1;i<=NF;i++)sub(/./,toupper(substr($i,1,1)),$i)}1' | sed -e 's/ //g') | |
echo "PROJECT_NAME=${PROJECT_NAME}" | |
echo "STACK_NAME=${PROJECT_NAME}StackSimpleFastAPI${{github.ref_name}}" | |
echo "STACK_NAME=${PROJECT_NAME}StackSimpleFastAPI${{github.ref_name}}" >> $GITHUB_ENV | |
echo "PROJECT_NAME=${PROJECT_NAME}SimpleFastAPI" >> $GITHUB_ENV | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Installing Dependencies to Deploy | |
run: | | |
npm install -g aws-cdk | |
cd iac | |
pip install -r requirements.txt | |
- name: Installing Dependencies to SimpleFastAPI | |
run: | | |
pip install -t src -r requirements.txt | |
- name: Setup envs | |
run: | | |
echo AWS_REGION=us-west-2 >> $GITHUB_ENV | |
echo AWS_ACCOUNT_ID=${{ secrets.AWS_ACCOUNT_ID }} >> $GITHUB_ENV | |
echo GITHUB_REF_NAME=${{ github.ref_name }} >> $GITHUB_ENV | |
echo ${{ env.AWS_REGION }} | |
echo ${{ env.AWS_ACCOUNT_ID }} | |
echo ${{ env.STACK_NAME }} | |
echo ${{ env.GITHUB_REF_NAME }} | |
- name: Deploy with CDK | |
run: | | |
cd iac | |
cdk synth | |
cdk deploy --require-approval never | |