|
10 | 10 | IMAGE_CACHE_REPOSITORY: "coralproject/ci" |
11 | 11 | DOCKERHUB_USERNAME: "coralproject" |
12 | 12 |
|
| 13 | +permissions: |
| 14 | + id-token: write |
| 15 | + contents: read |
| 16 | + |
13 | 17 | jobs: |
14 | 18 | build-and-test: |
15 | 19 | name: Test |
@@ -84,22 +88,25 @@ jobs: |
84 | 88 | - uses: webfactory/[email protected] |
85 | 89 | with: |
86 | 90 | ssh-private-key: ${{ secrets.REPO_PATCHED_DEPLOY_KEY }} |
87 | | - - name: Login to GAR |
88 | | - uses: docker/login-action@v3 |
| 91 | + - name: Authenticate to Google Cloud |
| 92 | + uses: google-github-actions/auth@v2 |
89 | 93 | with: |
90 | | - registry: us-east1-docker.pkg.dev |
91 | | - username: _json_key |
92 | | - password: ${{ secrets.GAR_JSON_KEY }} |
| 94 | + project_id: the-coral-project |
| 95 | + workload_identity_provider: projects/418768622481/locations/global/workloadIdentityPools/github-actions/providers/github |
| 96 | + service_account: [email protected] |
93 | 97 | - name: Login to Docker Hub |
94 | 98 | uses: docker/login-action@v3 |
95 | 99 | with: |
96 | 100 | username: ${{ env.DOCKERHUB_USERNAME }} |
97 | 101 | password: ${{ secrets.DOCKERHUB_PASSWORD }} |
| 102 | + - name: Configure Docker GAR |
| 103 | + run: | |
| 104 | + gcloud auth configure-docker us-east1-docker.pkg.dev --quiet |
98 | 105 | - name: Define SHORT_SHA with commit short sha |
99 | 106 | run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV |
100 | 107 | # Build tag push the image after a merge to develop |
101 | 108 | - name: Build and Push (develop) |
102 | | - if: github.ref == 'refs/heads/develop' || github.ref |
| 109 | + if: github.ref == 'refs/heads/develop' |
103 | 110 | run: | |
104 | 111 | docker buildx build \ |
105 | 112 | --platform linux/amd64 \ |
@@ -136,17 +143,20 @@ jobs: |
136 | 143 | - uses: webfactory/[email protected] |
137 | 144 | with: |
138 | 145 | ssh-private-key: ${{ secrets.REPO_PATCHED_DEPLOY_KEY }} |
139 | | - - name: Login to GAR |
140 | | - uses: docker/login-action@v3 |
| 146 | + - name: Authenticate to Google Cloud |
| 147 | + uses: google-github-actions/auth@v2 |
141 | 148 | with: |
142 | | - registry: us-east1-docker.pkg.dev |
143 | | - username: _json_key |
144 | | - password: ${{ secrets.GAR_JSON_KEY }} |
| 149 | + project_id: the-coral-project |
| 150 | + workload_identity_provider: projects/418768622481/locations/global/workloadIdentityPools/github-actions/providers/github |
| 151 | + service_account: [email protected] |
145 | 152 | - name: Login to Docker Hub |
146 | 153 | uses: docker/login-action@v3 |
147 | 154 | with: |
148 | 155 | username: ${{ env.DOCKERHUB_USERNAME }} |
149 | 156 | password: ${{ secrets.DOCKERHUB_PASSWORD }} |
| 157 | + - name: Configure Docker GAR |
| 158 | + run: | |
| 159 | + gcloud auth configure-docker us-east1-docker.pkg.dev --quiet |
150 | 160 | - name: Define SHORT_SHA with commit short sha |
151 | 161 | run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV |
152 | 162 | # Build for develop branch using native docker buildx |
@@ -185,12 +195,15 @@ jobs: |
185 | 195 | uses: actions/checkout@v4 |
186 | 196 | - name: Define SHORT_SHA with commit short sha |
187 | 197 | run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV |
188 | | - - name: Login to GAR |
189 | | - uses: docker/login-action@v3 |
| 198 | + - name: Authenticate to Google Cloud |
| 199 | + uses: google-github-actions/auth@v2 |
190 | 200 | with: |
191 | | - registry: us-east1-docker.pkg.dev |
192 | | - username: _json_key |
193 | | - password: ${{ secrets.GAR_JSON_KEY }} |
| 201 | + project_id: the-coral-project |
| 202 | + workload_identity_provider: projects/418768622481/locations/global/workloadIdentityPools/github-actions/providers/github |
| 203 | + service_account: [email protected] |
| 204 | + - name: Configure Docker GAR |
| 205 | + run: | |
| 206 | + gcloud auth configure-docker us-east1-docker.pkg.dev --quiet |
194 | 207 | - name: Create and Push Manifest for develop branch |
195 | 208 | if: github.ref == 'refs/heads/develop' |
196 | 209 | run: | |
|
0 commit comments