|
17 | 17 |
|
18 | 18 | outputs: |
19 | 19 | matrix: ${{ steps.set-matrix.outputs.matrix }} |
| 20 | + |
20 | 21 | steps: |
21 | 22 | - name: Checkout Code |
22 | 23 | uses: actions/checkout@v2 |
@@ -238,3 +239,54 @@ jobs: |
238 | 239 | cache-to: type=gha,mode=max |
239 | 240 | tags: ${{ steps.meta.outputs.tags }} |
240 | 241 | labels: ${{ steps.meta.outputs.labels }} |
| 242 | + |
| 243 | + build-rabbitmq: |
| 244 | + name: Build RabbitMQ |
| 245 | + runs-on: ubuntu-latest |
| 246 | + |
| 247 | + env: |
| 248 | + TZ: Asia/Shanghai |
| 249 | + |
| 250 | + permissions: |
| 251 | + contents: 'read' |
| 252 | + id-token: 'write' |
| 253 | + |
| 254 | + steps: |
| 255 | + - name: Checkout Code |
| 256 | + uses: actions/checkout@v2 |
| 257 | + |
| 258 | + - name: Authenticate with Google Cloud |
| 259 | + id: auth |
| 260 | + uses: google-github-actions/auth@v1 |
| 261 | + with: |
| 262 | + token_format: access_token |
| 263 | + workload_identity_provider: ${{ secrets.GCP_PROVIDER_ID }} |
| 264 | + service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}@${{ secrets.GCP_PROJECT_ID }}.iam.gserviceaccount.com |
| 265 | + access_token_lifetime: 1200s |
| 266 | + |
| 267 | + - name: Set up Docker BuildX |
| 268 | + uses: docker/setup-buildx-action@v2 |
| 269 | + |
| 270 | + - name: Login to Artifact Registry |
| 271 | + uses: docker/login-action@v2 |
| 272 | + with: |
| 273 | + registry: ${{ secrets.GCP_REGISTRY_REGION }}-docker.pkg.dev |
| 274 | + username: oauth2accesstoken |
| 275 | + password: ${{ steps.auth.outputs.access_token }} |
| 276 | + |
| 277 | + - name: Extract Docker metadata |
| 278 | + id: meta |
| 279 | + uses: docker/metadata-action@v4 |
| 280 | + with: |
| 281 | + images: ${{ secrets.GCP_REGISTRY_REGION }}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_REGISTRY_ID }}/rabbitmq |
| 282 | + |
| 283 | + - id: docker-push-tagged |
| 284 | + name: Tag Docker image and push to Google Artifact Registry |
| 285 | + uses: docker/build-push-action@v4 |
| 286 | + with: |
| 287 | + context: docker/rabbitmq |
| 288 | + push: true |
| 289 | + cache-from: type=gha |
| 290 | + cache-to: type=gha,mode=max |
| 291 | + tags: ${{ steps.meta.outputs.tags }} |
| 292 | + labels: ${{ steps.meta.outputs.labels }} |
0 commit comments