Skip to content

Commit c6438ec

Browse files
committed
ci: Enabled github actions build with github caching
1 parent 985336c commit c6438ec

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
# Maintain dependencies for GitHub Actions
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"

.github/workflows/ci.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- test/**
8+
tags:
9+
- "[0-9]+.[0-9]+.[0-9]+"
10+
pull_request:
11+
branches:
12+
- master
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
if: github.repository == 'itzg/docker-minecraft-bedrock-server'
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v2
22+
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v1
25+
26+
- name: Cache Docker layers
27+
uses: actions/cache@v2
28+
with:
29+
path: /tmp/.buildx-cache
30+
key: ${{ runner.os }}-buildx-${{ github.sha }}
31+
restore-keys: |
32+
${{ runner.os }}-buildx-
33+
34+
- name: Login to DockerHub
35+
if: github.event_name != 'pull_request'
36+
uses: docker/login-action@v1
37+
with:
38+
username: ${{ secrets.DOCKER_USER }}
39+
password: ${{ secrets.DOCKER_PASSWORD }}
40+
41+
- name: Docker Metadata action
42+
id: meta
43+
uses: docker/[email protected]
44+
with:
45+
images: itzg/minecraft-bedrock-server
46+
flavor: |
47+
latest=${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
48+
49+
- name: Build and push
50+
uses: docker/build-push-action@v2
51+
with:
52+
context: .
53+
push: ${{ github.event_name != 'pull_request' }}
54+
tags: ${{ steps.meta.outputs.tags }}
55+
labels: ${{ steps.meta.outputs.labels }}
56+
cache-from: type=local,src=/tmp/.buildx-cache
57+
cache-to: type=local,dest=/tmp/.buildx-cache-new
58+
- # Temp fix
59+
# https://github.com/docker/build-push-action/issues/252
60+
# https://github.com/moby/buildkit/issues/1896
61+
name: Move cache
62+
run: |
63+
rm -rf /tmp/.buildx-cache
64+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

0 commit comments

Comments
 (0)