Skip to content

Commit

Permalink
ci: replace dockerhub to GitHub container registry
Browse files Browse the repository at this point in the history
Signed-off-by: iGxnon <[email protected]>
  • Loading branch information
iGxnon authored and mergify[bot] committed Aug 16, 2023
1 parent 81967c5 commit d37bc50
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 23 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

env:
CI_RUST_TOOLCHAIN: 1.70.0
REGISTRY_IMAGE: datenlord/xline
IMAGE_ID: ghcr.io/xline-kv/xline

jobs:
push_image:
Expand Down Expand Up @@ -76,19 +76,20 @@ jobs:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Login to DockerHub
- name: Login to GHCR
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
registry: ghcr.io
username: xline-kv
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Docker Image
id: build_image
uses: docker/build-push-action@v4
with:
context: ./scripts
platforms: ${{ matrix.job.platform }}
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
outputs: type=image,name=${{ env.IMAGE_ID }},push-by-digest=true,name-canonical=true,push=true

- name: Export Digest
run: |
Expand Down
22 changes: 9 additions & 13 deletions .github/workflows/merge_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,9 @@ on:
app_version:
required: true
type: string
secrets:
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_TOKEN:
required: true

env:
REGISTRY_IMAGE: datenlord/xline
IMAGE_ID: ghcr.io/xline-kv/xline

jobs:
merge_image:
Expand All @@ -27,20 +22,21 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
- name: Login to GHCR
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
registry: ghcr.io
username: xline-kv
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push Manifest
working-directory: /tmp/digests
run: |
docker buildx imagetools create \
-t ${{ env.REGISTRY_IMAGE }}:latest \
-t ${{ env.REGISTRY_IMAGE }}:${{ inputs.app_version }} \
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
-t ${{ env.IMAGE_ID }}:latest \
-t ${{ env.IMAGE_ID }}:${{ inputs.app_version }} \
$(printf '${{ env.IMAGE_ID }}@sha256:%s ' *)
- name: Inspect Manifest
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ inputs.app_version }}
docker buildx imagetools inspect ${{ env.IMAGE_ID }}:${{ inputs.app_version }}
11 changes: 6 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

env:
CI_RUST_TOOLCHAIN: 1.70.0
REGISTRY_IMAGE: datenlord/xline
IMAGE_ID: ghcr.io/xline-kv/xline

jobs:
create_release:
Expand Down Expand Up @@ -122,12 +122,13 @@ jobs:
if: startsWith(matrix.job.platform, 'linux/')
uses: docker/setup-qemu-action@v1

- name: Login to DockerHub
- name: Login to GHCR
if: startsWith(matrix.job.platform, 'linux/')
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
registry: ghcr.io
username: xline-kv
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Docker Image
if: startsWith(matrix.job.platform, 'linux/')
Expand All @@ -136,7 +137,7 @@ jobs:
with:
context: ./scripts
platforms: ${{ matrix.job.platform }}
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
outputs: type=image,name=${{ env.IMAGE_ID }},push-by-digest=true,name-canonical=true,push=true

- name: Export Digest
if: startsWith(matrix.job.platform, 'linux/')
Expand Down

0 comments on commit d37bc50

Please sign in to comment.