Skip to content

Commit ed0104d

Browse files
committed
feat: use self-hosted ARM runner, better image tagging
1 parent 641f436 commit ed0104d

File tree

2 files changed

+52
-21
lines changed

2 files changed

+52
-21
lines changed
Lines changed: 51 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,83 @@
1-
name: Publish Docker image
1+
name: Make release & publish Docker image
22

33
on:
44
push:
55
tags:
6-
- 'v*.*.*'
6+
- 'v*'
77

88
jobs:
99
publish:
10-
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
runner-platform:
13+
- ubuntu-latest
14+
- self-hosted
15+
include:
16+
- runner-platform: ubuntu-latest
17+
build-arch: linux/amd64
18+
tagged-platform: amd64
19+
- runner-platform: self-hosted
20+
build-arch: linux/arm64
21+
tagged-platform: arm64
22+
runs-on: ${{ matrix.runner-platform }}
1123
steps:
1224
- name: Set up Buildx
1325
uses: docker/setup-buildx-action@v1
1426

15-
- name: Set up QEMU
16-
uses: docker/setup-qemu-action@v1
17-
1827
- name: Cache Docker layers
28+
# AWS data transfer is pricy
29+
if: ${{ matrix.runner-platform != 'self-hosted' }}
1930
uses: actions/cache@v2
2031
with:
2132
path: /tmp/.buildx-cache
22-
key: ${{ runner.os }}-buildx-${{ github.sha }}
33+
key: ${{ runner.os }}-buildx-prs-${{ matrix.build-arch }}-${{ github.sha }}
2334
restore-keys: |
24-
${{ runner.os }}-buildx-
35+
${{ runner.os }}-buildx-prs-${{ matrix.build-arch }}
2536
2637
- name: Login to DockerHub
2738
uses: docker/login-action@v1
2839
with:
2940
username: ${{ secrets.DOCKERHUB_USERNAME }}
3041
password: ${{ secrets.DOCKERHUB_TOKEN }}
3142

32-
- name: Limit concurrent builds to 1
33-
uses: softprops/turnstyle@v1
34-
env:
35-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36-
3743
- name: Build and push
3844
id: docker_build
3945
uses: docker/build-push-action@v2
4046
with:
4147
push: true
42-
tags: codetheweb/aoede:latest
43-
platforms: linux/amd64,linux/arm64
48+
tags: codetheweb/aoede:${{ github.sha }}-${{ matrix.tagged-platform }}
49+
platforms: ${{ matrix.build-arch }}
4450
cache-from: type=local,src=/tmp/.buildx-cache
45-
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
51+
cache-to: type=local,dest=/tmp/.buildx-cache,mode=min
4652

47-
- name: Update Docker Hub description
48-
uses: peter-evans/dockerhub-description@v3
53+
combine:
54+
name: Combine platform tags
55+
runs-on: ubuntu-latest
56+
needs: publish
57+
steps:
58+
- uses: actions/checkout@v1
59+
60+
- name: Set up Buildx
61+
uses: docker/setup-buildx-action@v1
62+
63+
- name: Login to DockerHub
64+
uses: docker/login-action@v1
4965
with:
5066
username: ${{ secrets.DOCKERHUB_USERNAME }}
51-
password: ${{ secrets.DOCKERHUB_PASSWORD }}
52-
repository: codetheweb/aoede
67+
password: ${{ secrets.DOCKERHUB_TOKEN }}
68+
69+
- name: Get tags
70+
id: get-tags
71+
uses: Surgo/docker-smart-tag-action@v1
72+
with:
73+
docker_image: codetheweb/aoede
74+
75+
- name: Combine tags
76+
run: docker buildx imagetools create $(echo '${{ steps.get-tags.outputs.tag }}' | tr "," "\0" | xargs -0 printf -- '-t %s ') 'codetheweb/aoede:${{ github.sha }}-arm64' 'codetheweb/aoede:${{ github.sha }}-amd64'
77+
78+
- name: Update Docker Hub description
79+
uses: peter-evans/dockerhub-description@v2.4.3
80+
env:
81+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
82+
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
83+
DOCKERHUB_REPOSITORY: codetheweb/aoede

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)