deploy to aws #268
This file contains hidden or 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 to aws | |
| permissions: | |
| id-token: write | |
| contents: read | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| environment: | |
| description: 'Environment to deploy' | |
| type: choice | |
| options: | |
| - DEV | |
| - PROD | |
| required: true | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install Zig toolchain | |
| uses: korandoru/setup-zig@v1 | |
| with: | |
| zig-version: 0.10.0 | |
| - name: Install Cargo Lambda | |
| uses: jaxxstorm/action-install-gh-release@v1.9.0 | |
| with: | |
| repo: cargo-lambda/cargo-lambda | |
| platform: linux | |
| arch: x86_64 | |
| - name: test | |
| run: cargo test | |
| - name: build | |
| run: ./build.sh | |
| - name: install dependencies | |
| run: | | |
| cd ./result-builder && yarn install | |
| - name: install CDK | |
| run: sudo yarn global add aws-cdk | |
| - name: configure aws credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} | |
| role-session-name: GitHub_Action_LambdaPerf_Session | |
| aws-region: ${{ inputs.environment == 'DEV' && secrets.AWS_DEV_REGION || inputs.environment == 'PROD' && secrets.AWS_PROD_REGION }} | |
| - name: deploy | |
| env: | |
| AWS_REGION: ${{ inputs.environment == 'DEV' && secrets.AWS_DEV_REGION || inputs.environment == 'PROD' && secrets.AWS_PROD_REGION }} | |
| LAMBDA_PERF_ENV: ${{ inputs.environment == 'PROD' && 'production' || 'dev' }} | |
| SKIP_SNAPSTART: ${{ (inputs.environment == 'DEV') && secrets.SKIP_SNAPSTART_DEV || 'false' }} | |
| GITHUB_AUTH_TOKEN: ${{ inputs.environment == 'PROD' && secrets.GH_AUTH_TOKEN || 'no-token-needed' }} | |
| AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} | |
| run: cd cdk && yarn install && cdk bootstrap && cdk deploy LambdaPerfStack --require-approval never |