Merge pull request #6 from Real-Life-IaC/add-gh-actions #14
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 | |
pull_request: | |
types: | |
- labeled | |
- synchronize | |
permissions: | |
id-token: write | |
jobs: | |
deploy-sandbox: | |
name: Sandbox Deploy | |
if: | | |
(github.event.action == 'labeled' && github.event.label.name == ':test_tube: sandbox deploy') || | |
(github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, ':test_tube: sandbox deploy')) || | |
(github.event_name == 'push' && github.ref_name == 'main') | |
environment: sandbox | |
concurrency: sandbox | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Deploy Stack | |
uses: ./.github/actions/deploy | |
with: | |
role-to-assume: ${{ vars.ROLE_TO_ASSUME }} | |
aws-region: ${{ vars.AWS_REGION }} | |
stack-name: Api-sandbox | |
deploy-staging: | |
if: github.ref_name == 'main' | |
name: Staging Deploy | |
environment: staging | |
concurrency: staging | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Deploy Stack | |
uses: ./.github/actions/deploy | |
with: | |
role-to-assume: ${{ vars.ROLE_TO_ASSUME }} | |
aws-region: ${{ vars.AWS_REGION }} | |
stack-name: Api-staging | |
deploy-production: | |
if: github.ref_name == 'main' | |
name: Production Deploy | |
environment: production | |
concurrency: production | |
runs-on: ubuntu-latest | |
needs: | |
- deploy-sandbox | |
- deploy-staging | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Deploy Stack | |
uses: ./.github/actions/deploy | |
with: | |
role-to-assume: ${{ vars.ROLE_TO_ASSUME }} | |
aws-region: ${{ vars.AWS_REGION }} | |
stack-name: Api-production |