88 lines
2.8 KiB
YAML
88 lines
2.8 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- test/**
|
|
tags:
|
|
- "[0-9]+.[0-9]+.[0-9]+"
|
|
paths-ignore:
|
|
- "*.md"
|
|
- "examples/**"
|
|
- "docs/**"
|
|
- "renovate.json5"
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
paths-ignore:
|
|
- "*.md"
|
|
- "examples/**"
|
|
- "docs/**"
|
|
- "renovate.json5"
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
IMAGE_BASE_NAME: minecraft-bedrock-server
|
|
# Assume they line up, but when forked change to your Docker Hub username
|
|
DOCKER_HUB_ORG: ${{ github.repository_owner }}
|
|
PUSH: ${{ github.repository_owner == 'itzg' }}
|
|
|
|
steps:
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v2
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Login to DockerHub
|
|
if: env.PUSH && github.event_name != 'pull_request'
|
|
uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ secrets.DOCKER_USER }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Login to GHCR
|
|
if: env.PUSH && github.event_name != 'pull_request'
|
|
uses: docker/login-action@v3.6.0
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ github.token }}
|
|
|
|
- name: Docker Metadata action
|
|
id: meta
|
|
uses: docker/metadata-action@v4
|
|
with:
|
|
images: |
|
|
${{ github.repository_owner }}/${{ env.IMAGE_BASE_NAME }}
|
|
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_BASE_NAME }}
|
|
tags: |
|
|
# pushes a tag matching the release/tag
|
|
type=pep440,pattern={{version}}
|
|
# stable is a moving tag that points to the latest release
|
|
type=pep440,pattern=stable
|
|
# and latest is a tag that always latest changes merged to default branch
|
|
type=raw,value=latest,enable=${{ github.ref_name == github.event.repository.default_branch }}
|
|
flavor: |
|
|
latest=false
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
push: ${{ env.PUSH && github.event_name != 'pull_request' }}
|
|
provenance: false
|
|
platforms: linux/amd64,linux/arm64
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: |
|
|
${{ steps.meta.outputs.labels }}
|
|
manymine.enable=true
|
|
pull: true
|
|
build-args: |
|
|
BUILDTIME=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
|
|
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
|
|
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|