Merge pull request #19 from wednesday-solutions/alenbaby13-patch-1 #12
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 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
name: Deploy to ECS | |
runs-on: ubuntu-latest | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set branch name | |
id: vars | |
run: echo ::set-output name=stage::${GITHUB_REF#refs/*/} | |
- name: Set env.ENVIRONMENT_NAME | |
run: | | |
if [[ ${{ steps.vars.outputs.stage }} == 'main' ]]; then | |
echo "ENVIRONMENT_NAME=dev" >> "$GITHUB_ENV" | |
else | |
echo "ENVIRONMENT_NAME=${{ steps.vars.outputs.stage }}" >> "$GITHUB_ENV" | |
fi | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Setup AWS Copilot | |
uses: softprops/setup-aws-copilot@v1 | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
- name: Deploy ECS | |
run: | | |
./scripts/update-ecs.sh gotemplatemysql ${{ env.ENVIRONMENT_NAME }} |