Skip to content

Commit 72f466a

Browse files
ci: update docker github action
1 parent baa569c commit 72f466a

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

.github/workflows/docker_release.yaml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ on:
77

88
env:
99
DOCKERHUB_IMAGE_NAME: shawndengdocker/ibkr_event_daemon
10-
GITHUB_IMAGE_NAME: ShawnDen-coder/ibkr_event_daemon
10+
GITHUB_IMAGE_NAME: ghcr.io/shawnden-coder/ibkr_event_daemon
1111

1212
jobs:
1313
push_to_registry:
14-
name: Push Docker image to Docker Hub
14+
name: Push Docker image to Docker Hub and GHCR
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Check out the repo
@@ -37,7 +37,7 @@ jobs:
3737
uses: docker/login-action@v3
3838
with:
3939
registry: ghcr.io
40-
username: ${{ github.repository_owner }}
40+
username: ${{ github.actor }}
4141
password: ${{ env.PERSONAL_ACCESS_TOKEN }}
4242

4343
- name: Set up QEMU
@@ -46,23 +46,24 @@ jobs:
4646
- name: Set up Docker Buildx
4747
uses: docker/setup-buildx-action@v3
4848

49-
- name: Validate build configuration
50-
uses: docker/build-push-action@v6
49+
- name: Docker meta
50+
id: meta
51+
uses: docker/metadata-action@v5
5152
with:
52-
call: check
53+
images: |
54+
${{ env.DOCKERHUB_IMAGE_NAME }}
55+
${{ env.GITHUB_IMAGE_NAME }}
56+
tags: |
57+
type=raw,value=latest,enable={{is_default_branch}}
58+
type=ref,event=tag
59+
type=ref,event=pr
60+
type=sha,format=short
5361
54-
- name: Build and push
62+
- name: Build and push Docker images
5563
uses: docker/build-push-action@v6
5664
with:
65+
context: .
5766
platforms: linux/amd64,linux/arm64
5867
push: true
59-
tags: |
60-
${{env.DOCKERHUB_IMAGE_NAME}}:latest
61-
${{env.DOCKERHUB_IMAGE_NAME}}:${{ github.ref_name}}
62-
63-
- name: Push image to GHCR
64-
run: |
65-
docker buildx imagetools create \
66-
--tag ${{ env.GITHUB_IMAGE_NAME }}:latest \
67-
--tag ${{ env.GITHUB_IMAGE_NAME }}:${{ github.ref_name }} \
68-
${{ env.DOCKERHUB_IMAGE_NAME }}:${{ github.ref_name }}
68+
tags: ${{ steps.meta.outputs.tags }}
69+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)