mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-07-20 07:24:54 +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
|
||||
mcHelperVersion: 1.51.3-java8
|
||||
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 }}"
|
||||
HAS_IMAGE_REPO_ACCESS: ${{ secrets.DOCKER_USER != '' && secrets.DOCKER_PASSWORD != '' }}
|
||||
MAIN_VARIANT: java25
|
||||
PUSH: ${{ github.repository_owner == 'itzg' }}
|
||||
IMAGE_AUTHOR: "Geoff Bourne <itzgeoff@gmail.com>"
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -117,10 +121,8 @@ jobs:
|
||||
id: meta
|
||||
uses: docker/metadata-action@v6.2.0
|
||||
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: |
|
||||
${{ github.repository_owner }}/minecraft-server
|
||||
${{ env.DOCKER_HUB_ORG }}/minecraft-server
|
||||
ghcr.io/${{ github.repository_owner }}/minecraft-server
|
||||
tags: |
|
||||
# Apply the variant as a moving tag for most recent commit per variant
|
||||
@@ -142,7 +144,7 @@ jobs:
|
||||
flavor: |
|
||||
latest=${{ matrix.variant == env.MAIN_VARIANT && github.ref_name == github.event.repository.default_branch }}
|
||||
labels: |
|
||||
org.opencontainers.image.authors=Geoff Bourne <itzgeoff@gmail.com>
|
||||
org.opencontainers.image.authors=${{ env.IMAGE_AUTHOR }}
|
||||
|
||||
- name: Setup Docker Buildx
|
||||
uses: docker/setup-buildx-action@v4
|
||||
@@ -198,13 +200,16 @@ jobs:
|
||||
platforms: ${{ matrix.platforms }}
|
||||
push: >
|
||||
${{
|
||||
github.ref_type == 'tag'
|
||||
|| github.ref_name == github.event.repository.default_branch
|
||||
|| 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')
|
||||
)
|
||||
env.PUSH &&
|
||||
(
|
||||
github.ref_type == 'tag'
|
||||
|| github.ref_name == github.event.repository.default_branch
|
||||
|| 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')
|
||||
)
|
||||
)
|
||||
}}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
# ensure latest base image is used
|
||||
@@ -221,5 +226,6 @@ jobs:
|
||||
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
|
||||
${{ matrix.mcHelperVersion && format('MC_HELPER_VERSION={0}', matrix.mcHelperVersion) }}
|
||||
${{ matrix.knockdRepoOrg && format('KNOCKD_REPO_ORG={0}', matrix.knockdRepoOrg) }}
|
||||
IMAGE_AUTHOR=${{ env.IMAGE_AUTHOR }}
|
||||
cache-from: type=gha,scope=${{ matrix.variant }}
|
||||
cache-to: type=gha,mode=max,scope=${{ matrix.variant }}
|
||||
|
||||
@@ -16,6 +16,7 @@ jobs:
|
||||
discord:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
if: github.repository_owner == 'itzg'
|
||||
steps:
|
||||
- name: on-publish
|
||||
if: github.event_name == 'release' && github.event.action == 'published'
|
||||
|
||||
@@ -13,6 +13,7 @@ on:
|
||||
- labeled
|
||||
jobs:
|
||||
notify:
|
||||
if: github.repository_owner == 'itzg'
|
||||
uses: itzg/github-workflows/.github/workflows/issues-notify-discord.yml@main
|
||||
with:
|
||||
triageLabel: 'status/needs triage'
|
||||
@@ -7,6 +7,7 @@ on:
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-22.04
|
||||
if: github.repository_owner == 'itzg'
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
Reference in New Issue
Block a user