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
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
env: | |
AWS_REGION: "us-east-1" | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
AssumeRoleAndCDKDeploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git clone the repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
cache: "npm" | |
- name: Configure AWS credentials | |
uses: aws-actions/[email protected] | |
with: | |
role-to-assume: arn:aws:iam::851725517932:role/AdministratorAccess | |
role-session-name: GitHub_to_AWS_via_FederatedOIDC | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Set AWS account ID | |
run: echo "AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)" >> $GITHUB_ENV | |
- name: Sts GetCallerIdentity | |
run: aws sts get-caller-identity | |
- name: Install AWS CDK CLI | |
run: npm install -g aws-cdk | |
- name: Install root project dependencies | |
run: npm ci | |
- name: Build and zip SSR application | |
run: | | |
cd ./cdk/src/services/vite-remix | |
npm install | |
npm run build | |
npm run zip | |
- name: List contents of build directory | |
run: ls -R ./cdk/src/services/vite-remix/build | |
- name: Install CDK project dependencies | |
run: | | |
cd ./cdk | |
npm ci | |
- name: Build CDK project | |
run: | | |
cd ./cdk | |
npm run build | |
- name: CDK Deploy | |
run: | | |
cd ./cdk | |
cdk deploy RemixStack --require-approval never | |
env: | |
AWS_REGION: ${{ env.AWS_REGION }} | |
AWS_ACCOUNT_ID: ${{ env.AWS_ACCOUNT_ID }} |