Skip to content

Publish image to GHCR also (#582) #262

Publish image to GHCR also (#582)

Publish image to GHCR also (#582) #262

Workflow file for this run

name: CI
on:
push:
branches:
- master
- test/**
tags:
- "[0-9]+.[0-9]+.[0-9]+"
paths-ignore:
- README.md
- "examples/**"
- "docs/**"
pull_request:
branches:
- master
paths-ignore:
- README.md
- "examples/**"
- "docs/**"
jobs:
build:
runs-on: ubuntu-latest
if: github.repository == 'itzg/docker-minecraft-bedrock-server'
env:
IMAGE_BASE_NAME: minecraft-bedrock-server
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: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/[email protected]
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 }}
flavor: |
latest=${{ github.event_name == 'push' && github.ref_name == 'master' }}
- name: Build and push
uses: docker/build-push-action@v4
with:
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