Skip to content

Commit 2764878

Browse files
authored
chore(ci): fix release image registries (#17914)
1 parent 63c1ece commit 2764878

File tree

3 files changed

+33
-3
lines changed

3 files changed

+33
-3
lines changed

.github/actions/setup_docker/action.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ outputs:
2020
ecr_repo:
2121
description: "AWS public ECR Repository"
2222
value: ${{ steps.registry.outputs.ecr }}
23+
ghcr_repo:
24+
description: "GitHub Container Registry Repository"
25+
value: ${{ steps.registry.outputs.ghcr }}
2326

2427
runs:
2528
using: "composite"
@@ -57,9 +60,17 @@ runs:
5760
username: ${{ inputs.dockerhub_user }}
5861
password: ${{ inputs.dockerhub_token }}
5962

63+
- name: Login to GHCR
64+
uses: docker/login-action@v3
65+
with:
66+
registry: ghcr.io
67+
username: ${{ github.repository_owner }}
68+
password: ${{ github.token }}
69+
6070
- name: Output Registries
6171
shell: bash
6272
id: registry
6373
run: |
6474
echo 'dockerhub=datafuselabs/${{ inputs.repo }}' >> $GITHUB_OUTPUT
6575
echo 'ecr=public.ecr.aws/i7g1w5q7/${{ inputs.repo }}' >> $GITHUB_OUTPUT
76+
echo 'ghcr=ghcr.io/${{ github.repository_owner }}/${{ inputs.repo }}' >> $GITHUB_OUTPUT

.github/workflows/cloud.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,28 @@ jobs:
103103
short_sha=$(echo "${{ needs.info.outputs.sha }}" | cut -c1-7)
104104
ts=$(date +%s)
105105
echo "tag=pr-${{ github.event.pull_request.number }}-${short_sha}-${ts}" >> $GITHUB_OUTPUT
106+
- name: Get Image Tags
107+
id: tags
108+
uses: actions/github-script@v7
109+
env:
110+
REPO_DOCKERHUB: ${{ steps.login.outputs.dockerhub_repo }}
111+
REPO_ECR: ${{ steps.login.outputs.ecr_repo }}
112+
REPO_GHCR: ${{ steps.login.outputs.ghcr_repo }}
113+
VERSION: ${{ steps.prepare.outputs.tag }}
114+
with:
115+
script: |
116+
const { VERSION, REPO_DOCKERHUB, REPO_ECR, REPO_GHCR } = process.env;
117+
const repos = [REPO_DOCKERHUB, REPO_ECR, REPO_GHCR];
118+
let tags = [];
119+
for (const repo of repos) {
120+
tags.push(`${repo}:${VERSION}`);
121+
}
122+
core.setOutput('tags', tags.join(','));
106123
- name: push service image
107124
uses: docker/build-push-action@v5
108125
with:
109126
push: true
110-
tags: ${{ steps.login.outputs.ecr_repo }}:${{ steps.prepare.outputs.tag }}
127+
tags: ${{ steps.tags.outputs.tags }}
111128
platforms: linux/amd64,linux/arm64
112129
context: .
113130
file: ./docker/service/query.Dockerfile

.github/workflows/release.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ permissions:
2929
checks: write
3030
statuses: write
3131
contents: write
32+
packages: write
3233

3334
env:
3435
BUILD_PROFILE: release
@@ -372,12 +373,13 @@ jobs:
372373
env:
373374
REPO_DOCKERHUB: ${{ steps.login.outputs.dockerhub_repo }}
374375
REPO_ECR: ${{ steps.login.outputs.ecr_repo }}
376+
REPO_GHCR: ${{ steps.login.outputs.ghcr_repo }}
375377
VERSION: ${{ needs.create_release.outputs.version }}
376378
TYPE: ${{ needs.create_release.outputs.type }}
377379
with:
378380
script: |
379-
const { VERSION, TYPE, REPO_DOCKERHUB, REPO_ECR } = process.env;
380-
const repos = [REPO_DOCKERHUB, REPO_ECR];
381+
const { VERSION, TYPE, REPO_DOCKERHUB, REPO_ECR, REPO_GHCR } = process.env;
382+
const repos = [REPO_DOCKERHUB, REPO_ECR, REPO_GHCR];
381383
let tags = [];
382384
for (const repo of repos) {
383385
tags.push(`${repo}:${VERSION}`);

0 commit comments

Comments
 (0)