Skip to content

Commit 22362f1

Browse files
author
neodiX
committed
improve docker github action - run test and add release tag, compile against arm64
1 parent fd280ff commit 22362f1

File tree

1 file changed

+32
-5
lines changed

1 file changed

+32
-5
lines changed

.github/workflows/docker-ubuntu-image.yml

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,49 @@ jobs:
2020
submodules: 'recursive'
2121

2222
- name: Set up QEMU
23-
uses: docker/setup-qemu-action@v1
23+
uses: docker/setup-qemu-action@v3
2424

2525
- name: Set up Docker Buildx
26-
uses: docker/setup-buildx-action@v1
26+
uses: docker/setup-buildx-action@v3
2727

2828
- name: Login to GitHub Container Registry
29-
uses: docker/login-action@v1
29+
uses: docker/login-action@v3
3030
with:
3131
registry: ${{ env.REGISTRY }}
3232
username: ${{ github.repository_owner }}
3333
password: ${{ secrets.GITHUB_TOKEN }}
3434

35+
- name: Build and export to Docker
36+
uses: docker/build-push-action@v6
37+
with:
38+
load: true
39+
context: ./
40+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:test
41+
42+
- name: Test
43+
run: |
44+
docker run --rm ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:test
45+
46+
- name: Get next tag
47+
id: tag
48+
run: |
49+
git fetch --all --tags
50+
git tag -l
51+
NEW_TAG=v$(date +'%Y.%m')
52+
FOUND=$(git tag -l | grep $NEW_TAG | wc -l)
53+
if [ $FOUND -eq 0 ]; then
54+
echo "TAG=$NEW_TAG" >> $GITHUB_OUTPUT
55+
else
56+
echo "TAG=$NEW_TAG-$FOUND" >> $GITHUB_OUTPUT
57+
fi
58+
3559
- name: Build and push
3660
id: docker_build
37-
uses: docker/build-push-action@v2
61+
uses: docker/build-push-action@v6
3862
with:
63+
platforms: linux/amd64,linux/arm64
3964
push: true
4065
context: ./
41-
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
66+
tags: |
67+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
68+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.TAG }}

0 commit comments

Comments
 (0)