|
106 | 106 | type: string |
107 | 107 | description: "Ulimit options (e.g., nofile=1024:1024)" |
108 | 108 | required: false |
| 109 | + registry-identities: |
| 110 | + type: string |
| 111 | + description: "Keyless registry identity configuration as YAML objects" |
| 112 | + required: false |
109 | 113 | # docker/metadata-action |
110 | 114 | set-meta-annotations: |
111 | 115 | type: boolean |
@@ -182,8 +186,15 @@ env: |
182 | 186 | NPM_CONFIG_FETCH_RETRIES: "5" |
183 | 187 |
|
184 | 188 | jobs: |
| 189 | + setup-registry-identities: |
| 190 | + uses: ./.github/workflows/setup-registry-identities.yml |
| 191 | + with: |
| 192 | + registry-identities: ${{ inputs.registry-identities }} |
| 193 | + |
185 | 194 | prepare: |
186 | 195 | runs-on: ubuntu-24.04 |
| 196 | + needs: |
| 197 | + - setup-registry-identities |
187 | 198 | outputs: |
188 | 199 | includes: ${{ steps.set.outputs.includes }} |
189 | 200 | metaImages: ${{ steps.set.outputs.metaImages }} |
@@ -463,6 +474,7 @@ jobs: |
463 | 474 | build: |
464 | 475 | runs-on: ${{ matrix.runner }} |
465 | 476 | needs: |
| 477 | + - setup-registry-identities |
466 | 478 | - prepare |
467 | 479 | strategy: |
468 | 480 | fail-fast: ${{ inputs.fail-fast }} |
@@ -811,9 +823,31 @@ jobs: |
811 | 823 | // for a public repository, we set max provenance mode |
812 | 824 | core.setOutput('provenance', Build.resolveProvenanceAttrs(`mode=max,version=v1`)); |
813 | 825 | } |
| 826 | + - |
| 827 | + name: Check registry auths |
| 828 | + id: registry-auths |
| 829 | + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 |
| 830 | + env: |
| 831 | + INPUT_REGISTRY-AUTHS: ${{ secrets.registry-auths }} |
| 832 | + with: |
| 833 | + script: | |
| 834 | + core.setOutput('present', core.getInput('registry-auths') ? 'true' : 'false'); |
| 835 | + - |
| 836 | + name: Configure AWS credentials |
| 837 | + if: ${{ needs.registry-identities.outputs.aws-ecr-enabled == 'true' }} |
| 838 | + uses: aws-actions/configure-aws-credentials@99214aa6889fcddfa57764031d71add364327e59 # v6.1.3 |
| 839 | + with: |
| 840 | + role-to-assume: ${{ needs.registry-identities.outputs.aws-ecr-role-to-assume }} |
| 841 | + aws-region: ${{ needs.registry-identities.outputs.aws-ecr-region }} |
| 842 | + - |
| 843 | + name: Login to Amazon ECR |
| 844 | + if: ${{ needs.registry-identities.outputs.aws-ecr-enabled == 'true' }} |
| 845 | + uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 |
| 846 | + with: |
| 847 | + registry-auth: ${{ needs.registry-identities.outputs.aws-ecr-registry-auth }} |
814 | 848 | - |
815 | 849 | name: Login to registry |
816 | | - if: ${{ inputs.push && inputs.output == 'image' }} |
| 850 | + if: ${{ inputs.push && inputs.output == 'image' && steps.registry-auths.outputs.present == 'true' }} |
817 | 851 | uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 |
818 | 852 | with: |
819 | 853 | registry-auth: ${{ secrets.registry-auths }} |
@@ -842,7 +876,7 @@ jobs: |
842 | 876 | GIT_AUTH_TOKEN: ${{ secrets.github-token || github.token }} |
843 | 877 | - |
844 | 878 | name: Login to registry for signing |
845 | | - if: ${{ needs.prepare.outputs.sign == 'true' && inputs.output == 'image' }} |
| 879 | + if: ${{ needs.prepare.outputs.sign == 'true' && inputs.output == 'image' && steps.registry-auths.outputs.present == 'true' }} |
846 | 880 | uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 |
847 | 881 | with: |
848 | 882 | registry-auth: ${{ secrets.registry-auths }} |
@@ -969,6 +1003,7 @@ jobs: |
969 | 1003 | output-type: ${{ inputs.output }} |
970 | 1004 | signed: ${{ needs.prepare.outputs.sign }} |
971 | 1005 | needs: |
| 1006 | + - registry-identities |
972 | 1007 | - prepare |
973 | 1008 | - build |
974 | 1009 | steps: |
@@ -1006,9 +1041,31 @@ jobs: |
1006 | 1041 | flavor: ${{ inputs.meta-flavor }} |
1007 | 1042 | labels: ${{ inputs.meta-labels }} |
1008 | 1043 | annotations: ${{ inputs.meta-annotations }} |
| 1044 | + - |
| 1045 | + name: Check registry auths |
| 1046 | + id: registry-auths |
| 1047 | + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 |
| 1048 | + env: |
| 1049 | + INPUT_REGISTRY-AUTHS: ${{ secrets.registry-auths }} |
| 1050 | + with: |
| 1051 | + script: | |
| 1052 | + core.setOutput('present', core.getInput('registry-auths') ? 'true' : 'false'); |
| 1053 | + - |
| 1054 | + name: Configure AWS credentials |
| 1055 | + if: ${{ inputs.push && inputs.output == 'image' && needs.registry-identities.outputs.aws-ecr-enabled == 'true' }} |
| 1056 | + uses: aws-actions/configure-aws-credentials@99214aa6889fcddfa57764031d71add364327e59 # v6.1.3 |
| 1057 | + with: |
| 1058 | + role-to-assume: ${{ needs.registry-identities.outputs.aws-ecr-role-to-assume }} |
| 1059 | + aws-region: ${{ needs.registry-identities.outputs.aws-ecr-region }} |
| 1060 | + - |
| 1061 | + name: Login to Amazon ECR |
| 1062 | + if: ${{ inputs.push && inputs.output == 'image' && needs.registry-identities.outputs.aws-ecr-enabled == 'true' }} |
| 1063 | + uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 |
| 1064 | + with: |
| 1065 | + registry-auth: ${{ needs.registry-identities.outputs.aws-ecr-registry-auth }} |
1009 | 1066 | - |
1010 | 1067 | name: Login to registry |
1011 | | - if: ${{ inputs.push && inputs.output == 'image' }} |
| 1068 | + if: ${{ inputs.push && inputs.output == 'image' && steps.registry-auths.outputs.present == 'true' }} |
1012 | 1069 | uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 |
1013 | 1070 | with: |
1014 | 1071 | registry-auth: ${{ secrets.registry-auths }} |
|
0 commit comments