Skip to content
This repository was archived by the owner on Jul 16, 2024. It is now read-only.

Commit ab1cbe7

Browse files
committed
ci(release): added rabbitmq building to docker-release.yaml
1 parent dce7c4c commit ab1cbe7

File tree

2 files changed

+52
-19
lines changed

2 files changed

+52
-19
lines changed

.github/workflows/docker-rabbitmq.yaml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,6 @@ jobs:
3030
- name: Checkout repository
3131
uses: actions/checkout@v3
3232

33-
- name: Authenticate with Google Cloud
34-
id: auth
35-
uses: google-github-actions/auth@v1
36-
if: github.event_name != 'pull_request'
37-
with:
38-
token_format: access_token
39-
workload_identity_provider: ${{ secrets.GCP_AHDARK_PROVIDER_ID }}
40-
service_account: ${{ secrets.GCP_AHDARK_SERVICE_ACCOUNT }}@${{ secrets.GCP_AHDARK_PROJECT_ID }}.iam.gserviceaccount.com
41-
access_token_lifetime: 1200s
42-
4333
# Workaround: https://github.com/docker/build-push-action/issues/461
4434
- name: Setup Docker buildx
4535
uses: docker/setup-buildx-action@v2
@@ -54,14 +44,6 @@ jobs:
5444
username: ${{ github.actor }}
5545
password: ${{ secrets.GITHUB_TOKEN }}
5646

57-
- name: Login to Google Artifact Registry
58-
if: github.event_name != 'pull_request'
59-
uses: docker/login-action@v2
60-
with:
61-
registry: ${{ secrets.GCP_AHDARK_REGISTRY_REGION }}-docker.pkg.dev
62-
username: oauth2accesstoken
63-
password: ${{ steps.auth.outputs.access_token }}
64-
6547
# Extract metadata (tags, labels) for Docker
6648
# https://github.com/docker/metadata-action
6749
- name: Extract Docker metadata
@@ -70,7 +52,6 @@ jobs:
7052
with:
7153
images: |
7254
ghcr.io/${{ github.repository }}-rabbitmq
73-
${{ secrets.GCP_AHDARK_REGISTRY_REGION }}-docker.pkg.dev/${{ secrets.GCP_AHDARK_PROJECT_ID }}/${{ secrets.GCP_AHDARK_REGISTRY_ID }}/rabbitmq
7455
7556
# Build and push Docker image with Buildx (don't push on PR)
7657
# https://github.com/docker/build-push-action

.github/workflows/docker-release.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717

1818
outputs:
1919
matrix: ${{ steps.set-matrix.outputs.matrix }}
20+
2021
steps:
2122
- name: Checkout Code
2223
uses: actions/checkout@v2
@@ -238,3 +239,54 @@ jobs:
238239
cache-to: type=gha,mode=max
239240
tags: ${{ steps.meta.outputs.tags }}
240241
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

Comments
 (0)