12
12
steps :
13
13
# Step 1: Check out the repository
14
14
- name : Checkout code
15
- uses : actions/checkout@v3
15
+ uses : actions/checkout@v4
16
16
17
17
# Step 2: Log in to Docker Hub
18
18
- name : Log in to Docker Hub
@@ -21,12 +21,44 @@ jobs:
21
21
username : ${{ secrets.DOCKER_USERNAME }}
22
22
password : ${{ secrets.DOCKER_PASSWORD }}
23
23
24
- # Step 3: Build the Docker image
25
- - name : Build Docker Image
26
- run : |
27
- docker build -t dumbwareio/dumbdrop:latest .
24
+ # Step 3: Setup QEMU to enable multiarch builds
25
+ - name : Set up QEMU
26
+ uses : docker/setup-qemu-action@v3
28
27
29
- # Step 4: Push the Docker image to Docker Hub
30
- - name : Push Docker Image
31
- run : |
32
- docker push dumbwareio/dumbdrop:latest
28
+ # Step 4: Set up docker buildx
29
+ - name : Set up Docker Buildx
30
+ uses : docker/setup-buildx-action@v3
31
+
32
+ # Step 5: Extract metadata and set versions
33
+ - name : Extract metadata (tags, labels) for Docker
34
+ id : meta
35
+ uses : docker/metadata-action@v5
36
+ with :
37
+ # image name is dumbdrop, in the docker user's repo
38
+ # this allows the push to work in forks
39
+ images : |
40
+ name=${{ secrets.DOCKER_USERNAME }}/dumbdrop
41
+ tags : |
42
+ # the semantic versioning tags add "latest" when a version tag is present
43
+ # but since version tags aren't being used (yet?) let's add "latest" anyway
44
+ type=raw,value=latest
45
+ # output x.y.z, based on a tag vx.y.z (e.g. 1.1.2 for a tag v1.1.2)
46
+ type=semver,pattern={{version}}
47
+ # output x.y, based on a tag vx.y.z
48
+ type=semver,pattern={{major}}.{{minor}}
49
+ # output x, based on a tag vx.y.z, disabled if x is zero
50
+ type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
51
+ # full length sha
52
+ type=sha,format=long
53
+
54
+ # Step 6: build and push the image for multiple archs
55
+ - name : Build and push Docker image
56
+ id : push
57
+ uses : docker/build-push-action@v6
58
+ with :
59
+ context : .
60
+ push : true
61
+ tags : ${{ steps.meta.outputs.tags }}
62
+ labels : ${{ steps.meta.outputs.labels }}
63
+ # build and push for amd64 and arm64 platforms
64
+ platforms : linux/amd64,linux/arm64
0 commit comments