-
Notifications
You must be signed in to change notification settings - Fork 168
61 lines (52 loc) · 1.6 KB
/
docker.yml
File metadata and controls
61 lines (52 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Docker
on:
push:
tags:
- 'moq-relay-v*'
- 'moq-cli-v*'
- 'moq-token-cli-v*'
env:
REGISTRY: docker.io/moqdev
jobs:
deploy:
name: Release
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- uses: actions/checkout@v6
# Figure out the docker image based on the tag
- id: parse
run: |
ref=${GITHUB_REF#refs/tags/}
if [[ "$ref" =~ ^([a-z-]+)-v([0-9.]+)$ ]]; then
target="${BASH_REMATCH[1]}"
version="${BASH_REMATCH[2]}"
echo "target=$target" >> $GITHUB_OUTPUT
echo "version=$version" >> $GITHUB_OUTPUT
else
echo "Tag format not recognized." >&2
exit 1
fi
# I'm paying for Depot for faster ARM builds.
- uses: depot/setup-action@v1
# Login to docker.io
- uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Build and push multi-arch Docker images using Depot
- uses: depot/build-push-action@v1
with:
project: r257ctfqm6
context: .
push: true
# Make a smaller image by specifying the package to build
build-args: |
package=${{ steps.parse.outputs.target }}
tags: |
${{ env.REGISTRY }}/${{ steps.parse.outputs.target }}:${{ steps.parse.outputs.version }}
${{ env.REGISTRY }}/${{ steps.parse.outputs.target }}:latest
platforms: linux/amd64,linux/arm64