mirror of
https://github.com/itzg/docker-minecraft-server
synced 2024-12-13 22:02:28 +00:00
Deploy images to both dockerhub and ghcr (#2051)
Co-authored-by: Geoff Bourne <itzgeoff@gmail.com>
This commit is contained in:
parent
326c43e544
commit
3e9e64e788
1 changed files with 16 additions and 4 deletions
20
.github/workflows/build-multiarch.yml
vendored
20
.github/workflows/build-multiarch.yml
vendored
|
@ -113,14 +113,16 @@ jobs:
|
|||
# then the use of ${{ github.repository_owner }} will need to be replaced.
|
||||
images: |
|
||||
${{ github.repository_owner }}/minecraft-server
|
||||
ghcr.io/${{ github.repository_owner }}/minecraft-server
|
||||
tags: |
|
||||
type=ref,event=tag,enable=${{ matrix.variant == 'java17' }}
|
||||
type=ref,event=tag,enable=${{ matrix.variant == 'java17' && github.ref == 'master' }}
|
||||
type=ref,event=tag,suffix=-${{ matrix.variant }}
|
||||
type=raw,value=${{ matrix.variant }}
|
||||
type=ref,event=branch,suffix=-${{ matrix.variant }},enable=${{ github.ref != 'master' }}
|
||||
type=raw,value=${{ matrix.variant }},enable=${{ github.ref == 'master' }}
|
||||
# NOTE this identifies which variant will be published as "latest", which isn't
|
||||
# necessarily the newest version of Java
|
||||
flavor: |
|
||||
latest=${{ matrix.variant == 'java17' }}
|
||||
latest=${{ matrix.variant == 'java17' && github.ref == 'master' }}
|
||||
labels: |
|
||||
org.opencontainers.image.authors=Geoff Bourne <itzgeoff@gmail.com>
|
||||
|
||||
|
@ -150,6 +152,7 @@ jobs:
|
|||
MINECRAFT_VERSION: ${{ matrix.mcVersion }}
|
||||
VARIANT: ${{ matrix.variant }}
|
||||
MODS_FORGEAPI_KEY: ${{ secrets.MODS_FORGEAPI_KEY }}
|
||||
CF_API_KEY: ${{ secrets.MODS_FORGEAPI_KEY }}
|
||||
run: |
|
||||
tests/test.sh
|
||||
|
||||
|
@ -160,6 +163,14 @@ jobs:
|
|||
username: ${{ secrets.DOCKER_USER }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Login to GHCR
|
||||
uses: docker/login-action@v2
|
||||
if: env.HAS_IMAGE_REPO_ACCESS
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ github.token }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v3.3.0
|
||||
if: github.actor == github.repository_owner
|
||||
|
@ -168,7 +179,8 @@ jobs:
|
|||
push: >
|
||||
${{
|
||||
github.ref_type == 'tag'
|
||||
|| github.ref_name == 'master'
|
||||
|| github.ref_name == 'master'
|
||||
|| startsWith(github.ref_name, 'test/')
|
||||
|| ( github.event_name == 'pull_request'
|
||||
&& env.HAS_IMAGE_REPO_ACCESS
|
||||
&& contains(github.event.pull_request.labels.*.name, 'ci/push-image')
|
||||
|
|
Loading…
Reference in a new issue