Skip to content

Commit 6441714

Browse files
committed
Automatically publish Docker images on GitHub
1 parent 528e7a3 commit 6441714

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

.github/workflows/docker.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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+
tags: |
43+
type=semver,pattern={{version}},event=tag
44+
type=ref,event=branch
45+
type=sha
46+
47+
- name: Set up QEMU
48+
uses: docker/setup-qemu-action@v2
49+
50+
- name: Set up Docker Buildx
51+
uses: docker/setup-buildx-action@v2
52+
53+
- name: Build and push Docker images
54+
uses: docker/build-push-action@v3
55+
with:
56+
context: .
57+
file: docker/Dockerfile
58+
# enable arm64 once native runners are available
59+
#platforms: linux/amd64,linux/arm64
60+
platforms: linux/amd64
61+
push: ${{ github.event_name != 'pull_request' }}
62+
tags: ${{ steps.meta.outputs.tags }}

0 commit comments

Comments
 (0)