Skip to content

Commit ca58ffd

Browse files
committed
Make image build workflow manual-only with the IAM role from a repo var
Modeled on PortBench's build-docker-images-epoch-hawk.yaml: trigger is workflow_dispatch only, and the IAM role comes from the AWS_ECR_PUSH_ROLE repository variable instead of a hardcoded ARN.
1 parent 40e442c commit ca58ffd

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

.github/workflows/build-docker-images.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1-
name: Build LeanOpenProblems Docker Images and Upload to Amazon ECR
1+
name: Build LeanOpenProblems Docker Images and Upload to Amazon ECR (manual)
22

3+
# This workflow is only ever triggered manually (workflow_dispatch). For the
4+
# "Run workflow" button to appear, this file must exist on the default branch
5+
# (main); you can then select a different branch to run.
6+
#
7+
# The ECR registry and the IAM role to assume come from repository
8+
# variables (Settings -> Secrets and variables -> Actions -> Variables):
9+
# ECR_REGISTRY, AWS_ECR_PUSH_ROLE.
310
on:
411
workflow_dispatch:
5-
push:
6-
branches: [main]
712

813
permissions:
914
contents: read
1015
id-token: write
1116

1217
env:
1318
IMAGE_NAME: ${{ vars.ECR_REGISTRY }}
19+
AWS_ECR_PUSH_ROLE: ${{ vars.AWS_ECR_PUSH_ROLE }}
1420

1521
jobs:
1622
publish-lean-images:
@@ -23,7 +29,7 @@ jobs:
2329
- uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df # v4.2.1
2430
with:
2531
aws-region: ${{ steps.ecr.outputs.region }}
26-
role-to-assume: arn:aws:iam::328726945407:role/production-github-actions-epochai
32+
role-to-assume: ${{ env.AWS_ECR_PUSH_ROLE }}
2733

2834
- uses: actions/checkout@v4
2935

0 commit comments

Comments
 (0)