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 pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Build Blog | |
run: | | |
pnpm i | |
pnpm build | |
- name: List contents of doc_build | |
run: ls -R ./doc_build | |
- name: Install cdk project dependencies | |
run: | | |
cd ./cdk | |
npm i | |
npm run build | |
npx cdk deploy BlogStack --require-approval never | |
env: | |
AWS_REGION: ${{ env.AWS_REGION }} | |
AWS_ACCOUNT_ID: ${{ env.AWS_ACCOUNT_ID }} |