mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-07-20 23:44:53 +00:00
Enhance workflow conditionals for forked repositories and notifications (#4179)
This commit is contained in:
+17
-11
@@ -102,9 +102,13 @@ jobs:
|
|||||||
# Pin version for Java 8, also be sure to set in verify-pr.yml
|
# Pin version for Java 8, also be sure to set in verify-pr.yml
|
||||||
mcHelperVersion: 1.51.3-java8
|
mcHelperVersion: 1.51.3-java8
|
||||||
env:
|
env:
|
||||||
|
# Assume they line up, but when forked change to your Docker Hub username
|
||||||
|
DOCKER_HUB_ORG: ${{ github.repository_owner }}
|
||||||
IMAGE_TO_TEST: "${{ github.repository_owner }}/minecraft-server:test-${{ matrix.variant }}-${{ github.run_id }}"
|
IMAGE_TO_TEST: "${{ github.repository_owner }}/minecraft-server:test-${{ matrix.variant }}-${{ github.run_id }}"
|
||||||
HAS_IMAGE_REPO_ACCESS: ${{ secrets.DOCKER_USER != '' && secrets.DOCKER_PASSWORD != '' }}
|
HAS_IMAGE_REPO_ACCESS: ${{ secrets.DOCKER_USER != '' && secrets.DOCKER_PASSWORD != '' }}
|
||||||
MAIN_VARIANT: java25
|
MAIN_VARIANT: java25
|
||||||
|
PUSH: ${{ github.repository_owner == 'itzg' }}
|
||||||
|
IMAGE_AUTHOR: "Geoff Bourne <itzgeoff@gmail.com>"
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -117,10 +121,8 @@ jobs:
|
|||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v6.2.0
|
uses: docker/metadata-action@v6.2.0
|
||||||
with:
|
with:
|
||||||
# NOTE for forks: if your Docker Hub organization doesn't match your Github repo's,
|
|
||||||
# then the use of ${{ github.repository_owner }} will need to be replaced.
|
|
||||||
images: |
|
images: |
|
||||||
${{ github.repository_owner }}/minecraft-server
|
${{ env.DOCKER_HUB_ORG }}/minecraft-server
|
||||||
ghcr.io/${{ github.repository_owner }}/minecraft-server
|
ghcr.io/${{ github.repository_owner }}/minecraft-server
|
||||||
tags: |
|
tags: |
|
||||||
# Apply the variant as a moving tag for most recent commit per variant
|
# Apply the variant as a moving tag for most recent commit per variant
|
||||||
@@ -142,7 +144,7 @@ jobs:
|
|||||||
flavor: |
|
flavor: |
|
||||||
latest=${{ matrix.variant == env.MAIN_VARIANT && github.ref_name == github.event.repository.default_branch }}
|
latest=${{ matrix.variant == env.MAIN_VARIANT && github.ref_name == github.event.repository.default_branch }}
|
||||||
labels: |
|
labels: |
|
||||||
org.opencontainers.image.authors=Geoff Bourne <itzgeoff@gmail.com>
|
org.opencontainers.image.authors=${{ env.IMAGE_AUTHOR }}
|
||||||
|
|
||||||
- name: Setup Docker Buildx
|
- name: Setup Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v4
|
uses: docker/setup-buildx-action@v4
|
||||||
@@ -198,13 +200,16 @@ jobs:
|
|||||||
platforms: ${{ matrix.platforms }}
|
platforms: ${{ matrix.platforms }}
|
||||||
push: >
|
push: >
|
||||||
${{
|
${{
|
||||||
github.ref_type == 'tag'
|
env.PUSH &&
|
||||||
|| github.ref_name == github.event.repository.default_branch
|
(
|
||||||
|| startsWith(github.ref_name, 'test/')
|
github.ref_type == 'tag'
|
||||||
|| ( github.event_name == 'pull_request'
|
|| github.ref_name == github.event.repository.default_branch
|
||||||
&& env.HAS_IMAGE_REPO_ACCESS
|
|| startsWith(github.ref_name, 'test/')
|
||||||
&& contains(github.event.pull_request.labels.*.name, 'ci/push-image')
|
|| ( github.event_name == 'pull_request'
|
||||||
)
|
&& env.HAS_IMAGE_REPO_ACCESS
|
||||||
|
&& contains(github.event.pull_request.labels.*.name, 'ci/push-image')
|
||||||
|
)
|
||||||
|
)
|
||||||
}}
|
}}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
# ensure latest base image is used
|
# ensure latest base image is used
|
||||||
@@ -221,5 +226,6 @@ jobs:
|
|||||||
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
|
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
|
||||||
${{ matrix.mcHelperVersion && format('MC_HELPER_VERSION={0}', matrix.mcHelperVersion) }}
|
${{ matrix.mcHelperVersion && format('MC_HELPER_VERSION={0}', matrix.mcHelperVersion) }}
|
||||||
${{ matrix.knockdRepoOrg && format('KNOCKD_REPO_ORG={0}', matrix.knockdRepoOrg) }}
|
${{ matrix.knockdRepoOrg && format('KNOCKD_REPO_ORG={0}', matrix.knockdRepoOrg) }}
|
||||||
|
IMAGE_AUTHOR=${{ env.IMAGE_AUTHOR }}
|
||||||
cache-from: type=gha,scope=${{ matrix.variant }}
|
cache-from: type=gha,scope=${{ matrix.variant }}
|
||||||
cache-to: type=gha,mode=max,scope=${{ matrix.variant }}
|
cache-to: type=gha,mode=max,scope=${{ matrix.variant }}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ jobs:
|
|||||||
discord:
|
discord:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 5
|
timeout-minutes: 5
|
||||||
|
if: github.repository_owner == 'itzg'
|
||||||
steps:
|
steps:
|
||||||
- name: on-publish
|
- name: on-publish
|
||||||
if: github.event_name == 'release' && github.event.action == 'published'
|
if: github.event_name == 'release' && github.event.action == 'published'
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ on:
|
|||||||
- labeled
|
- labeled
|
||||||
jobs:
|
jobs:
|
||||||
notify:
|
notify:
|
||||||
|
if: github.repository_owner == 'itzg'
|
||||||
uses: itzg/github-workflows/.github/workflows/issues-notify-discord.yml@main
|
uses: itzg/github-workflows/.github/workflows/issues-notify-discord.yml@main
|
||||||
with:
|
with:
|
||||||
triageLabel: 'status/needs triage'
|
triageLabel: 'status/needs triage'
|
||||||
@@ -7,6 +7,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
check:
|
check:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
if: github.repository_owner == 'itzg'
|
||||||
permissions:
|
permissions:
|
||||||
issues: write
|
issues: write
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
|||||||
Reference in New Issue
Block a user