mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-07-07 09:05:09 +00:00
Deploy images to both dockerhub and ghcr (#2051)
Co-authored-by: Geoff Bourne <itzgeoff@gmail.com>
This commit is contained in:
@@ -113,14 +113,16 @@ jobs:
|
|||||||
# then the use of ${{ github.repository_owner }} will need to be replaced.
|
# then the use of ${{ github.repository_owner }} will need to be replaced.
|
||||||
images: |
|
images: |
|
||||||
${{ github.repository_owner }}/minecraft-server
|
${{ github.repository_owner }}/minecraft-server
|
||||||
|
ghcr.io/${{ github.repository_owner }}/minecraft-server
|
||||||
tags: |
|
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=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
|
# NOTE this identifies which variant will be published as "latest", which isn't
|
||||||
# necessarily the newest version of Java
|
# necessarily the newest version of Java
|
||||||
flavor: |
|
flavor: |
|
||||||
latest=${{ matrix.variant == 'java17' }}
|
latest=${{ matrix.variant == 'java17' && github.ref == 'master' }}
|
||||||
labels: |
|
labels: |
|
||||||
org.opencontainers.image.authors=Geoff Bourne <itzgeoff@gmail.com>
|
org.opencontainers.image.authors=Geoff Bourne <itzgeoff@gmail.com>
|
||||||
|
|
||||||
@@ -150,6 +152,7 @@ jobs:
|
|||||||
MINECRAFT_VERSION: ${{ matrix.mcVersion }}
|
MINECRAFT_VERSION: ${{ matrix.mcVersion }}
|
||||||
VARIANT: ${{ matrix.variant }}
|
VARIANT: ${{ matrix.variant }}
|
||||||
MODS_FORGEAPI_KEY: ${{ secrets.MODS_FORGEAPI_KEY }}
|
MODS_FORGEAPI_KEY: ${{ secrets.MODS_FORGEAPI_KEY }}
|
||||||
|
CF_API_KEY: ${{ secrets.MODS_FORGEAPI_KEY }}
|
||||||
run: |
|
run: |
|
||||||
tests/test.sh
|
tests/test.sh
|
||||||
|
|
||||||
@@ -160,6 +163,14 @@ jobs:
|
|||||||
username: ${{ secrets.DOCKER_USER }}
|
username: ${{ secrets.DOCKER_USER }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
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
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v3.3.0
|
uses: docker/build-push-action@v3.3.0
|
||||||
if: github.actor == github.repository_owner
|
if: github.actor == github.repository_owner
|
||||||
@@ -168,7 +179,8 @@ jobs:
|
|||||||
push: >
|
push: >
|
||||||
${{
|
${{
|
||||||
github.ref_type == 'tag'
|
github.ref_type == 'tag'
|
||||||
|| github.ref_name == 'master'
|
|| github.ref_name == 'master'
|
||||||
|
|| startsWith(github.ref_name, 'test/')
|
||||||
|| ( github.event_name == 'pull_request'
|
|| ( github.event_name == 'pull_request'
|
||||||
&& env.HAS_IMAGE_REPO_ACCESS
|
&& env.HAS_IMAGE_REPO_ACCESS
|
||||||
&& contains(github.event.pull_request.labels.*.name, 'ci/push-image')
|
&& contains(github.event.pull_request.labels.*.name, 'ci/push-image')
|
||||||
|
|||||||
Reference in New Issue
Block a user