|
1 | | -name: Deploy |
| 1 | +name: Deploy Infrastructure |
2 | 2 |
|
3 | 3 | permissions: |
4 | 4 | id-token: write |
|
10 | 10 | aws_region: |
11 | 11 | required: true |
12 | 12 | type: string |
13 | | - account_id: |
14 | | - required: true |
15 | | - type: string |
16 | 13 | build_from_source: |
17 | 14 | required: false |
18 | 15 | type: boolean |
19 | 16 | default: true |
| 17 | + secrets: |
| 18 | + MODEL_RUNNER_ACCOUNT_ID: |
| 19 | + required: true |
20 | 20 |
|
21 | 21 | env: |
22 | 22 | AWS_REGION: ${{ inputs.aws_region }} |
23 | 23 | AWS_PAGER: "" |
| 24 | + NODE_VERSION: '24' |
| 25 | + PYTHON_VERSION: '3.13' |
24 | 26 |
|
25 | 27 | jobs: |
26 | | - deploy: |
| 28 | + deploy-infrastructure: |
27 | 29 | runs-on: ubuntu-latest |
| 30 | + timeout-minutes: 60 |
28 | 31 | steps: |
29 | 32 | - name: Checkout code |
30 | 33 | uses: actions/checkout@v4 |
31 | 34 | with: |
32 | 35 | lfs: 'true' |
33 | | - - name: Configure AWS Credentials |
34 | | - uses: aws-actions/configure-aws-credentials@v4 |
| 36 | + - name: Setup AWS OIDC |
| 37 | + uses: ./.github/actions/setup-aws-oidc |
35 | 38 | with: |
36 | | - aws-region: ${{ inputs.aws_region }} |
37 | | - role-to-assume: arn:aws:iam::${{ inputs.account_id }}:role/GithubAction-AssumeRoleWithAction |
38 | | - role-session-name: GitHub_to_AWS_via_FederatedOIDC |
39 | | - role-duration-seconds: 7200 |
40 | | - - name: Setup Node.js |
41 | | - uses: actions/setup-node@v4 |
| 39 | + aws_region: ${{ inputs.aws_region }} |
| 40 | + account_id: ${{ secrets.MODEL_RUNNER_ACCOUNT_ID }} |
| 41 | + role_duration_seconds: '7200' |
| 42 | + - name: Setup CDK |
| 43 | + uses: ./.github/actions/setup-cdk |
42 | 44 | with: |
43 | | - node-version: '18' |
44 | | - - name: Install CDK and dependencies |
45 | | - working-directory: cdk |
46 | | - run: | |
47 | | - npm install -g aws-cdk |
48 | | - npm install |
| 45 | + node_version: ${{ env.NODE_VERSION }} |
49 | 46 | - name: Generate deployment.json |
50 | | - working-directory: cdk |
51 | | - run: | |
52 | | - python3 << 'EOF' |
53 | | - import json |
54 | | - with open('bin/deployment/deployment.json.example') as f: |
55 | | - config = json.load(f) |
56 | | - config['account']['id'] = '${{ inputs.account_id }}' |
57 | | - config['account']['prodLike'] = False |
58 | | - if 'networkConfig' in config: |
59 | | - del config['networkConfig'] |
60 | | - if 'dataplaneConfig' in config: |
61 | | - config['dataplaneConfig']['BUILD_FROM_SOURCE'] = ${{ inputs.build_from_source }} |
62 | | - if 'testModelsConfig' in config: |
63 | | - config['testModelsConfig']['BUILD_FROM_SOURCE'] = ${{ inputs.build_from_source }} |
64 | | - with open('bin/deployment/deployment.json', 'w') as f: |
65 | | - json.dump(config, f, indent=2) |
66 | | - EOF |
| 47 | + uses: ./.github/actions/generate-deployment-json |
| 48 | + with: |
| 49 | + account_id: ${{ secrets.MODEL_RUNNER_ACCOUNT_ID }} |
| 50 | + build_from_source: ${{ inputs.build_from_source }} |
67 | 51 | - name: Build and synthesize CDK |
68 | 52 | working-directory: cdk |
69 | 53 | run: | |
|
0 commit comments