Skip to content

Commit d8f43f2

Browse files
committed
Automatically publish Docker images on GitHub
1 parent 82ef382 commit d8f43f2

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

.github/workflows/docker.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Build Docker images for Blue Nebula server
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
branches:
8+
- "*"
9+
pull_request:
10+
branches:
11+
- master
12+
13+
jobs:
14+
build-and-push:
15+
runs-on: ubuntu-latest
16+
17+
permissions:
18+
contents: read
19+
packages: write
20+
21+
steps:
22+
- uses: actions/checkout@v3
23+
24+
- name: Fetch relevant submodules
25+
run: |
26+
git submodule update --init src/enet
27+
git submodule update --init data/maps
28+
29+
- name: Log in to the Container registry
30+
uses: docker/login-action@v2
31+
with:
32+
registry: ghcr.io
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Docker meta
37+
id: meta
38+
uses: docker/metadata-action@v4
39+
with:
40+
images: |
41+
#ghcr.io/blue-nebula/server
42+
ghcr.io/blue-nebula/bn-server
43+
tags: |
44+
type=semver,pattern={{version}},event=tag
45+
type=ref,event=branch
46+
type=sha
47+
48+
- name: Set up QEMU
49+
uses: docker/setup-qemu-action@v2
50+
51+
- name: Set up Docker Buildx
52+
uses: docker/setup-buildx-action@v2
53+
54+
- name: Build and push Docker images
55+
uses: docker/build-push-action@v3
56+
with:
57+
context: .
58+
file: docker/Dockerfile
59+
#platforms: linux/amd64,linux/arm64
60+
# enable arm64 once native runners are available
61+
platforms: linux/amd64
62+
push: ${{ github.event_name != 'pull_request' }}
63+
tags: ${{ steps.meta.outputs.tags }}

0 commit comments

Comments
 (0)