Skip to content

Commit b5a80b0

Browse files
committed
Refactor release workflow to use Docker actions and multi-arch build
1 parent 6d71918 commit b5a80b0

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

.github/workflows/release.yml

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,30 +39,34 @@ jobs:
3939
id: version
4040
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
4141

42-
- name: Log in to Docker Hub
43-
run: |
44-
echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
42+
- name: Set up QEMU
43+
uses: docker/setup-qemu-action@v3
4544

46-
- name: Build the Docker image
47-
run: |
48-
docker build -t ${{ env.DOCKER_REPO }}/${{ env.DOCKER_IMAGE }}:latest .
45+
- name: Set up Docker Buildx
46+
uses: docker/setup-buildx-action@v3
4947

50-
- name: Tag the Docker image
51-
run: |
52-
docker tag ${{ env.DOCKER_REPO }}/${{ env.DOCKER_IMAGE }}:latest ${{ env.DOCKER_REPO }}/${{ env.DOCKER_IMAGE }}:${{ steps.version.outputs.VERSION }}
48+
- name: Log in to Docker Hub
49+
uses: docker/login-action@v3
50+
with:
51+
username: ${{ secrets.DOCKERHUB_USERNAME }}
52+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
5353

54-
- name: Push the Docker image to Docker Hub
55-
run: |
56-
docker push ${{ env.DOCKER_REPO }}/${{ env.DOCKER_IMAGE }}:latest
57-
docker push ${{ env.DOCKER_REPO }}/${{ env.DOCKER_IMAGE }}:${{ steps.version.outputs.VERSION }}
54+
- name: Build and push Docker image
55+
uses: docker/build-push-action@v6
56+
with:
57+
context: .
58+
platforms: linux/amd64,linux/arm64
59+
push: true
60+
tags: |
61+
${{ env.DOCKER_REPO }}/${{ env.DOCKER_IMAGE }}:latest
62+
${{ env.DOCKER_REPO }}/${{ env.DOCKER_IMAGE }}:${{ steps.version.outputs.VERSION }}
63+
cache-from: type=gha
64+
cache-to: type=gha,mode=max
5865

5966
- name: Create GitHub Release
60-
uses: actions/create-release@v1
61-
env:
62-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
uses: softprops/action-gh-release@v2
6368
with:
64-
tag_name: ${{ github.ref }}
65-
release_name: Release ${{ steps.version.outputs.VERSION }}
69+
name: Release ${{ steps.version.outputs.VERSION }}
6670
body: |
6771
## Docker Image
6872

0 commit comments

Comments
 (0)