|
| 1 | +name: AMI Prebuild |
| 2 | + |
| 3 | +# Schedule to run every 15 days to keep runner agent up to date |
| 4 | +# GitHub stops routing jobs to runners with agents older than 30 days |
| 5 | +on: |
| 6 | + # TODO: Remove push trigger after testing |
| 7 | + push: |
| 8 | + branches: [ji/ami-prebuild] |
| 9 | + paths: |
| 10 | + - ".github/workflows/ami-prebuild.yml" |
| 11 | + - ".github/actions/build-ami/**" |
| 12 | + schedule: |
| 13 | + # Run at 00:00 UTC on the 1st and 16th of each month (~15 days apart) |
| 14 | + - cron: "0 0 1,16 * *" |
| 15 | + workflow_dispatch: |
| 16 | + inputs: |
| 17 | + arch: |
| 18 | + description: "Architecture to build (leave empty for both)" |
| 19 | + required: false |
| 20 | + type: choice |
| 21 | + options: |
| 22 | + - "" |
| 23 | + - x64 |
| 24 | + - arm64 |
| 25 | + retention-days: |
| 26 | + description: "Days until AMI deprecation" |
| 27 | + required: false |
| 28 | + type: number |
| 29 | + default: 30 |
| 30 | + |
| 31 | +concurrency: |
| 32 | + group: ${{ github.workflow }} |
| 33 | + cancel-in-progress: false |
| 34 | + |
| 35 | +permissions: |
| 36 | + contents: read |
| 37 | + id-token: write |
| 38 | + |
| 39 | +env: |
| 40 | + AWS_REGION: us-east-1 |
| 41 | + |
| 42 | +jobs: |
| 43 | + build-x64: |
| 44 | + name: "Build AMI (x64)" |
| 45 | + if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.arch == '' || github.event.inputs.arch == 'x64' }} |
| 46 | + runs-on: |
| 47 | + - runs-on=${{ github.run_id }} |
| 48 | + - family=m7i+m7i-flex+m7a |
| 49 | + - cpu=4 |
| 50 | + - image=ubuntu24-full-x64 |
| 51 | + - tag=ami-prebuild-x64 |
| 52 | + timeout-minutes: 60 |
| 53 | + |
| 54 | + steps: |
| 55 | + - name: Checkout |
| 56 | + uses: actions/checkout@v6 |
| 57 | + |
| 58 | + - name: Configure AWS Credentials |
| 59 | + uses: aws-actions/configure-aws-credentials@v4 |
| 60 | + with: |
| 61 | + role-to-assume: arn:aws:iam::375504701696:role/GitHubBenchmarkRole |
| 62 | + aws-region: ${{ env.AWS_REGION }} |
| 63 | + |
| 64 | + - name: Build AMI |
| 65 | + id: build |
| 66 | + uses: ./.github/actions/build-ami |
| 67 | + with: |
| 68 | + arch: x64 |
| 69 | + aws-region: ${{ env.AWS_REGION }} |
| 70 | + retention-days: ${{ inputs.retention-days || '30' }} |
| 71 | + |
| 72 | + - name: Summary |
| 73 | + run: | |
| 74 | + echo "## AMI Build Complete (x64)" >> $GITHUB_STEP_SUMMARY |
| 75 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 76 | + echo "- **AMI ID:** ${{ steps.build.outputs.ami-id }}" >> $GITHUB_STEP_SUMMARY |
| 77 | + echo "- **AMI Name:** ${{ steps.build.outputs.ami-name }}" >> $GITHUB_STEP_SUMMARY |
| 78 | + echo "- **Deprecation:** ${{ inputs.retention-days || '30' }} days" >> $GITHUB_STEP_SUMMARY |
| 79 | +
|
| 80 | + build-arm64: |
| 81 | + name: "Build AMI (arm64)" |
| 82 | + if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.arch == '' || github.event.inputs.arch == 'arm64' }} |
| 83 | + runs-on: |
| 84 | + - runs-on=${{ github.run_id }} |
| 85 | + - family=m7g |
| 86 | + - cpu=4 |
| 87 | + - image=ubuntu24-full-arm64 |
| 88 | + - tag=ami-prebuild-arm64 |
| 89 | + timeout-minutes: 60 |
| 90 | + |
| 91 | + steps: |
| 92 | + - name: Checkout |
| 93 | + uses: actions/checkout@v6 |
| 94 | + |
| 95 | + - name: Configure AWS Credentials |
| 96 | + uses: aws-actions/configure-aws-credentials@v4 |
| 97 | + with: |
| 98 | + role-to-assume: arn:aws:iam::375504701696:role/GitHubBenchmarkRole |
| 99 | + aws-region: ${{ env.AWS_REGION }} |
| 100 | + |
| 101 | + - name: Build AMI |
| 102 | + id: build |
| 103 | + uses: ./.github/actions/build-ami |
| 104 | + with: |
| 105 | + arch: arm64 |
| 106 | + aws-region: ${{ env.AWS_REGION }} |
| 107 | + retention-days: ${{ inputs.retention-days || '30' }} |
| 108 | + |
| 109 | + - name: Summary |
| 110 | + run: | |
| 111 | + echo "## AMI Build Complete (arm64)" >> $GITHUB_STEP_SUMMARY |
| 112 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 113 | + echo "- **AMI ID:** ${{ steps.build.outputs.ami-id }}" >> $GITHUB_STEP_SUMMARY |
| 114 | + echo "- **AMI Name:** ${{ steps.build.outputs.ami-name }}" >> $GITHUB_STEP_SUMMARY |
| 115 | + echo "- **Deprecation:** ${{ inputs.retention-days || '30' }} days" >> $GITHUB_STEP_SUMMARY |
0 commit comments