Apply fork-friendly workflow changes from docker-mc-proxy#361 (#664)
- Use github.repository_owner instead of hardcoded 'itzg' for Docker Hub org - Add PUSH environment variable to control when images are pushed (only on itzg repo) - Update login conditions to only run on original repo (env.PUSH) - Add repository_owner check to issues-notify workflow These changes allow workflows to work correctly when the repository is forked. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
1 parent
bb6212aa58
commit
5275a0517e
5 files changed
+22
-5
No files matched your search
@@ -24,9 +24,11 @@ on:
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'itzg/docker-minecraft-bedrock-server'
|
||||
env:
|
||||
IMAGE_BASE_NAME: minecraft-bedrock-server
|
||||
# Assume they line up, but when forked change to your Docker Hub username
|
||||
DOCKER_HUB_ORG: ${{ github.repository_owner }}
|
||||
PUSH: ${{ github.repository_owner == 'itzg' }}
|
||||
|
||||
steps:
|
||||
- name: Set up QEMU
|
||||
@@ -36,14 +38,14 @@ jobs:
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Login to DockerHub
|
||||
if: github.event_name != 'pull_request'
|
||||
if: env.PUSH && 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'
|
||||
if: env.PUSH && github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v3.6.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
@@ -69,7 +71,7 @@ jobs:
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
push: ${{ env.PUSH && github.event_name != 'pull_request' }}
|
||||
provenance: false
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
|
||||
Reference in new issue
Block a user