Skip to content

Commit 3e772d9

Browse files
Make GitHub Actions build the Docker image for us.
1 parent 95ef96b commit 3e772d9

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.github/workflows/build.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
tags:
8+
- "v*.*.*"
9+
10+
jobs:
11+
docker:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Docker meta
19+
id: meta
20+
uses: docker/metadata-action@v4
21+
with:
22+
# list of Docker images to use as base name for tags
23+
images: |
24+
ghcr.io/UnityMultiplayer/Hotspot
25+
# generate Docker tags based on the following events/attributes
26+
tags: |
27+
type=schedule
28+
type=ref,event=branch
29+
type=ref,event=pr
30+
type=semver,pattern={{version}}
31+
type=semver,pattern={{major}}.{{minor}}
32+
type=semver,pattern={{major}}
33+
type=sha
34+
35+
- name: Set up QEMU
36+
uses: docker/setup-qemu-action@v2
37+
38+
- name: Set up Docker Buildx
39+
uses: docker/setup-buildx-action@v2
40+
41+
- name: Login to GitHub Container Registry
42+
uses: docker/login-action@v2
43+
with:
44+
registry: ghcr.io
45+
username: ${{ github.actor }}
46+
password: ${{ secrets.GITHUB_TOKEN }}
47+
48+
- name: Build and push
49+
uses: docker/build-push-action@v3
50+
with:
51+
context: .
52+
platforms: linux/amd64,linux/arm64
53+
push: ${{ github.event_name != 'pull_request' }}
54+
tags: ${{ steps.meta.outputs.tags }}
55+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)