Skip to content

Commit 24d19c9

Browse files
committed
adding build workflow to repo
uploading build image to DH and GHCR
1 parent f8b75b1 commit 24d19c9

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

.github/workflows/build.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
- "feature-*"
8+
- "bug-*"
9+
tags:
10+
- "v*"
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
19+
- name: Docker meta
20+
id: docker_meta
21+
uses: docker/metadata-action@v3.6.0
22+
with:
23+
images: |
24+
tibiadata/tibiadata-api-go
25+
ghcr.io/tibiadata/tibiadata-api-go
26+
27+
- name: Set up QEMU
28+
uses: docker/setup-qemu-action@v1.2.0
29+
30+
- name: Set up Docker Buildx
31+
uses: docker/setup-buildx-action@v1.6.0
32+
33+
- name: Cache Docker layers
34+
uses: actions/cache@v2.1.6
35+
with:
36+
path: /tmp/.buildx-cache
37+
key: ${{ runner.os }}-buildx-${{ github.sha }}
38+
restore-keys: |
39+
${{ runner.os }}-buildx-
40+
41+
- name: Login to DockerHub
42+
if: github.event_name != 'pull_request'
43+
uses: docker/login-action@v1.12.0
44+
with:
45+
username: ${{ secrets.DOCKERHUB_USERNAME }}
46+
password: ${{ secrets.DOCKERHUB_TOKEN }}
47+
48+
- name: Login to GitHub Container Registry
49+
if: github.event_name != 'pull_request'
50+
uses: docker/login-action@v1.12.0
51+
with:
52+
registry: ghcr.io
53+
username: ${{ github.actor }}
54+
password: ${{ secrets.GITHUB_TOKEN }}
55+
56+
- name: Build and push
57+
uses: docker/build-push-action@v2.7.0
58+
with:
59+
context: .
60+
file: ./Dockerfile
61+
platforms: linux/amd64,linux/arm/v7,linux/arm64
62+
push: ${{ github.event_name != 'pull_request' }}
63+
tags: ${{ steps.docker_meta.outputs.tags }}
64+
labels: ${{ steps.docker_meta.outputs.labels }}
65+
cache-from: type=local,src=/tmp/.buildx-cache
66+
cache-to: type=local,dest=/tmp/.buildx-cache
67+
build-args: |
68+
TibiadataBuildBuilder=github
69+
TibiadataBuildRelease=${{ github.event.release.tag_name }}
70+
TibiadataBuildCommit=${{ github.sha }}

0 commit comments

Comments
 (0)