Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 8 additions & 90 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,95 +12,13 @@ concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false

env:
AWS_ENV_CODE: dev

jobs:
deploy:
name: Deploy

runs-on: ubuntu-latest
timeout-minutes: 30

permissions:
id-token: write
contents: read

steps:
- name: Checkout
uses: actions/checkout@v6

- name: Setup Node.js Environment
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: npm

- name: Install Dependencies
run: npm ci

- name: Create Environment Configuration
run: |
echo "${{ vars.ENV_DEV }}" > .env
echo "VITE_BUILD_DATE=$(date -u +'%Y-%m-%d')" >> .env
echo "VITE_BUILD_TIME=$(date -u +'%H:%M:%S')" >> .env
echo "VITE_BUILD_TS=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> .env
echo "VITE_BUILD_COMMIT_SHA=${{ github.sha }}" >> .env
echo "VITE_BUILD_ENV_CODE=${{ env.AWS_ENV_CODE }}" >> .env
echo "VITE_BUILD_WORKFLOW_RUNNER=GitHub Actions" >> .env
echo "VITE_BUILD_WORKFLOW_NAME=${{ github.workflow }}" >> .env
echo "VITE_BUILD_WORKFLOW_RUN_NUMBER=${{ github.run_number }}" >> .env
echo "VITE_BUILD_WORKFLOW_RUN_ATTEMPT=${{ github.run_attempt }}" >> .env

- name: Build
run: npm run build

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v6
with:
aws-region: ${{ vars.AWS_REGION }}
role-to-assume: ${{ vars.AWS_ROLE_ARN_DEV }}
role-session-name: deploy-ionic8-starter-dev

- name: Install infrastructure dependencies
working-directory: ./infrastructure
run: npm ci

- name: Create infrastructure .env file
working-directory: ./infrastructure
run: |
echo "${{ vars.CDK_ENV_DEV }}" > .env
echo "✅ Infrastructure .env file created"

- name: Build infrastructure
working-directory: ./infrastructure
run: npm run build

- name: Bootstrap CDK
working-directory: ./infrastructure
run: |
echo "⚡ Checking if CDK bootstrap is needed..."
# Try to describe the bootstrap stack to see if it exists
if ! aws cloudformation describe-stacks --stack-name CDKToolkit --region ${{ vars.AWS_REGION }} >/dev/null 2>&1; then
echo "🚀 CDK not bootstrapped, bootstrapping now..."
npm run bootstrap
else
echo "✅ CDK already bootstrapped, skipping..."
fi

- name: Synthesize CDK stacks
working-directory: ./infrastructure
run: npm run synth

- name: Deploy CDK stacks
working-directory: ./infrastructure
run: npm run deploy:all -- --require-approval never

- name: Clean up sensitive files
if: always()
working-directory: ./infrastructure
run: |
echo "🧹 Cleaning up sensitive files..."
rm -f .env
rm -rf cdk.out
echo "✅ Sensitive files cleaned up"
name: Deploy to DEV
uses: ./.github/workflows/deploy-reusable.yml
with:
aws_region: ${{ vars.AWS_REGION }}
aws_role_arn: ${{ vars.AWS_ROLE_ARN_DEV }}
env_code: dev
env_file: ${{ vars.ENV_DEV }}
cdk_env_file: ${{ vars.CDK_ENV_DEV }}
98 changes: 8 additions & 90 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,95 +12,13 @@ concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false

env:
AWS_ENV_CODE: prd

jobs:
deploy:
name: Deploy

runs-on: ubuntu-latest
timeout-minutes: 30

permissions:
id-token: write
contents: read

steps:
- name: Checkout
uses: actions/checkout@v6

- name: Setup Node.js Environment
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: npm

- name: Install Dependencies
run: npm ci

- name: Create Environment Configuration
run: |
echo "${{ vars.ENV_PROD }}" > .env
echo "VITE_BUILD_DATE=$(date -u +'%Y-%m-%d')" >> .env
echo "VITE_BUILD_TIME=$(date -u +'%H:%M:%S')" >> .env
echo "VITE_BUILD_TS=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> .env
echo "VITE_BUILD_COMMIT_SHA=${{ github.sha }}" >> .env
echo "VITE_BUILD_ENV_CODE=${{ env.AWS_ENV_CODE }}" >> .env
echo "VITE_BUILD_WORKFLOW_RUNNER=GitHub Actions" >> .env
echo "VITE_BUILD_WORKFLOW_NAME=${{ github.workflow }}" >> .env
echo "VITE_BUILD_WORKFLOW_RUN_NUMBER=${{ github.run_number }}" >> .env
echo "VITE_BUILD_WORKFLOW_RUN_ATTEMPT=${{ github.run_attempt }}" >> .env

- name: Build
run: npm run build

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v6
with:
aws-region: ${{ vars.AWS_REGION }}
role-to-assume: ${{ vars.AWS_ROLE_ARN_PROD }}
role-session-name: deploy-ionic8-starter-prod

- name: Install infrastructure dependencies
working-directory: ./infrastructure
run: npm ci

- name: Create infrastructure .env file
working-directory: ./infrastructure
run: |
echo "${{ vars.CDK_ENV_PROD }}" > .env
echo "✅ Infrastructure .env file created"

- name: Build infrastructure
working-directory: ./infrastructure
run: npm run build

- name: Bootstrap CDK
working-directory: ./infrastructure
run: |
echo "⚡ Checking if CDK bootstrap is needed..."
# Try to describe the bootstrap stack to see if it exists
if ! aws cloudformation describe-stacks --stack-name CDKToolkit --region ${{ vars.AWS_REGION }} >/dev/null 2>&1; then
echo "🚀 CDK not bootstrapped, bootstrapping now..."
npm run bootstrap
else
echo "✅ CDK already bootstrapped, skipping..."
fi

- name: Synthesize CDK stacks
working-directory: ./infrastructure
run: npm run synth

- name: Deploy CDK stacks
working-directory: ./infrastructure
run: npm run deploy:all -- --require-approval never

- name: Clean up sensitive files
if: always()
working-directory: ./infrastructure
run: |
echo "🧹 Cleaning up sensitive files..."
rm -f .env
rm -rf cdk.out
echo "✅ Sensitive files cleaned up"
name: Deploy to PROD
uses: ./.github/workflows/deploy-reusable.yml
with:
aws_region: ${{ vars.AWS_REGION }}
aws_role_arn: ${{ vars.AWS_ROLE_ARN_PROD }}
env_code: prod
env_file: ${{ vars.ENV_PROD }}
cdk_env_file: ${{ vars.CDK_ENV_PROD }}
98 changes: 8 additions & 90 deletions .github/workflows/deploy-qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,95 +11,13 @@ concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false

env:
AWS_ENV_CODE: qa

jobs:
deploy:
name: Deploy

runs-on: ubuntu-latest
timeout-minutes: 30

permissions:
id-token: write
contents: read

steps:
- name: Checkout
uses: actions/checkout@v6

- name: Setup Node.js Environment
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: npm

- name: Install Dependencies
run: npm ci

- name: Create Environment Configuration
run: |
echo "${{ vars.ENV_QA }}" > .env
echo "VITE_BUILD_DATE=$(date -u +'%Y-%m-%d')" >> .env
echo "VITE_BUILD_TIME=$(date -u +'%H:%M:%S')" >> .env
echo "VITE_BUILD_TS=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> .env
echo "VITE_BUILD_COMMIT_SHA=${{ github.sha }}" >> .env
echo "VITE_BUILD_ENV_CODE=${{ env.AWS_ENV_CODE }}" >> .env
echo "VITE_BUILD_WORKFLOW_RUNNER=GitHub Actions" >> .env
echo "VITE_BUILD_WORKFLOW_NAME=${{ github.workflow }}" >> .env
echo "VITE_BUILD_WORKFLOW_RUN_NUMBER=${{ github.run_number }}" >> .env
echo "VITE_BUILD_WORKFLOW_RUN_ATTEMPT=${{ github.run_attempt }}" >> .env

- name: Build
run: npm run build

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v6
with:
aws-region: ${{ vars.AWS_REGION }}
role-to-assume: ${{ vars.AWS_ROLE_ARN_QA }}
role-session-name: deploy-ionic8-starter-qa

- name: Install infrastructure dependencies
working-directory: ./infrastructure
run: npm ci

- name: Create infrastructure .env file
working-directory: ./infrastructure
run: |
echo "${{ vars.CDK_ENV_QA }}" > .env
echo "✅ Infrastructure .env file created"

- name: Build infrastructure
working-directory: ./infrastructure
run: npm run build

- name: Bootstrap CDK
working-directory: ./infrastructure
run: |
echo "⚡ Checking if CDK bootstrap is needed..."
# Try to describe the bootstrap stack to see if it exists
if ! aws cloudformation describe-stacks --stack-name CDKToolkit --region ${{ vars.AWS_REGION }} >/dev/null 2>&1; then
echo "🚀 CDK not bootstrapped, bootstrapping now..."
npm run bootstrap
else
echo "✅ CDK already bootstrapped, skipping..."
fi

- name: Synthesize CDK stacks
working-directory: ./infrastructure
run: npm run synth

- name: Deploy CDK stacks
working-directory: ./infrastructure
run: npm run deploy:all -- --require-approval never

- name: Clean up sensitive files
if: always()
working-directory: ./infrastructure
run: |
echo "🧹 Cleaning up sensitive files..."
rm -f .env
rm -rf cdk.out
echo "✅ Sensitive files cleaned up"
name: Deploy to QA
uses: ./.github/workflows/deploy-reusable.yml
with:
aws_region: ${{ vars.AWS_REGION }}
aws_role_arn: ${{ vars.AWS_ROLE_ARN_QA }}
env_code: qa
env_file: ${{ vars.ENV_QA }}
cdk_env_file: ${{ vars.CDK_ENV_QA }}
Loading