Skip to content

Commit e177056

Browse files
ci: keep it simple
1 parent e17ba34 commit e177056

File tree

1 file changed

+31
-41
lines changed

1 file changed

+31
-41
lines changed

.github/workflows/docker-image.yml

+31-41
Original file line numberDiff line numberDiff line change
@@ -11,68 +11,48 @@ jobs:
1111
build-and-push:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- name: Checkout repository
15-
uses: actions/checkout@v3
14+
- name: Checkout Repository
15+
uses: actions/checkout@v4
16+
17+
- name: Set up QEMU
18+
uses: docker/setup-qemu-action@v3
1619

1720
- name: Set up Docker Buildx
18-
uses: docker/setup-buildx-action@v2
21+
uses: docker/setup-buildx-action@v3
22+
with:
23+
driver-opts: image=moby/buildkit:latest
1924

2025
- name: Log in to Docker Hub
21-
uses: docker/login-action@v2
26+
uses: docker/login-action@v3
2227
with:
23-
username: ${{ secrets.DOCKER_USERNAME }}
28+
username: ${{ github.repository_owner }}
2429
password: ${{ secrets.DOCKER_PASSWORD }}
2530

2631
- name: Log in to the Container registry
27-
uses: docker/login-action@v2
32+
uses: docker/login-action@v3
2833
with:
2934
registry: ghcr.io
3035
username: ${{ github.actor }}
3136
password: ${{ secrets.GITHUB_TOKEN }}
3237

33-
- name: Extract version number
34-
id: get_version
35-
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
36-
if: startsWith(github.ref, 'refs/tags/')
37-
38-
- name: Cache Docker layers
39-
uses: actions/cache@v3
40-
with:
41-
path: /tmp/.buildx-cache
42-
key: ${{ runner.os }}-buildx-${{ github.sha }}
43-
restore-keys: |
44-
${{ runner.os }}-buildx-
45-
46-
- name: Build and push Docker image
47-
uses: docker/build-push-action@v5
48-
with:
49-
context: .
50-
push: true
51-
tags: |
52-
davidecavestro/gphotos-cdp:dev-main
53-
davidecavestro/gphotos-cdp:${{ github.sha }}
54-
ghcr.io/davidecavestro/gphotos-cdp:dev-main
55-
ghcr.io/davidecavestro/gphotos-cdp:${{ github.sha }}
56-
cache-from: type=local,src=/tmp/.buildx-cache
57-
cache-to: type=local,dest=/tmp/.buildx-cache
58-
if: github.ref == 'refs/heads/main'
59-
60-
- name: Build and push tagged Docker image
38+
- name: Build and push image
6139
uses: docker/build-push-action@v5
6240
with:
6341
context: .
42+
platforms: linux/amd64,linux/arm64
6443
push: true
6544
tags: |
66-
davidecavestro/gphotos-cdp:${{ env.VERSION }}
45+
davidecavestro/gphotos-cdp:${{ github.ref_name }}
6746
davidecavestro/gphotos-cdp:latest
68-
ghcr.io/davidecavestro/gphotos-cdp:${{ env.VERSION }}
47+
ghcr.io/davidecavestro/gphotos-cdp:${{ github.ref_name }}
6948
ghcr.io/davidecavestro/gphotos-cdp:latest
70-
if: startsWith(github.ref, 'refs/tags/')
49+
cache-from: type=gha
50+
cache-to: type=gha,mode=max
7151

7252
- name: Docker Hub Description
7353
uses: peter-evans/dockerhub-description@v4
7454
with:
75-
username: ${{ secrets.DOCKER_USERNAME }}
55+
username: ${{ github.repository_owner }}
7656
password: ${{ secrets.DOCKER_PASSWORD }}
7757
repository: davidecavestro/gphotos-cdp
7858
short-description: ${{ github.event.repository.description }}
@@ -104,8 +84,9 @@ jobs:
10484
tag_name: ${{ github.ref_name }}
10585
release_name: v${{ github.ref_name }}
10686
body: |
107-
This release provides the container image:
108-
`davidecavestro/gphotos-cdp:${{ github.ref_name }}`
87+
Container images for this release:
88+
- Docker Hub: `davidecavestro/gphotos-cdp:${{ github.ref_name }}`
89+
- GitHub Container Registry: `ghcr.io/davidecavestro/gphotos-cdp:${{ github.ref_name }}`
10990
${{ steps.changelog.outputs.changes }}
11091
draft: false
11192
prerelease: false
@@ -115,4 +96,13 @@ jobs:
11596
with:
11697
branch: main
11798
commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]'
118-
file_pattern: CHANGELOG.md
99+
file_pattern: CHANGELOG.md
100+
101+
- name: Docker Hub Description
102+
uses: peter-evans/dockerhub-description@v4
103+
with:
104+
username: ${{ github.repository_owner }}
105+
password: ${{ secrets.DOCKER_PASSWORD }}
106+
repository: davidecavestro/usql
107+
short-description: ${{ github.event.repository.description }}
108+
enable-url-completion: true

0 commit comments

Comments
 (0)