ci: Fix how workflows behave in forks (#3074)

This commit is contained in:
Ayaz Salikhov
2026-05-14 17:59:33 +01:00
committed by GitHub
parent dbc98894ba
commit 3112a3d214
6 changed files with 17 additions and 16 deletions

View File

@@ -14,9 +14,9 @@ on:
type: boolean
description: Whether to strip clio binary
default: true
publish_image:
push_image:
type: boolean
description: Whether to publish docker image
description: Whether to push docker image
required: true
workflow_dispatch:
@@ -43,7 +43,7 @@ defaults:
shell: bash
jobs:
build_and_publish_image:
build_and_push_image:
name: Build and publish image
runs-on: ubuntu-latest
@@ -102,7 +102,7 @@ jobs:
images: |
ghcr.io/${{ steps.set-ghcr-repo.outputs.GHCR_REPO }}/clio
${{ github.repository_owner == 'XRPLF' && 'rippleci/clio' || '' }}
push_image: ${{ inputs.publish_image }}
push_image: ${{ inputs.push_image }}
directory: docker/clio
tags: ${{ inputs.tags }}
platforms: linux/amd64

View File

@@ -55,6 +55,7 @@ jobs:
name: docs-develop
deploy:
if: ${{ github.repository == 'XRPLF/clio' && github.event_name == 'push' }}
needs: build
permissions:
pages: write

View File

@@ -157,7 +157,7 @@ jobs:
type=raw,value=${{ github.sha }}
artifact_name: clio_server_Linux_Release_gcc
strip_binary: true
publish_image: ${{ github.event_name != 'pull_request' }}
push_image: ${{ github.repository == 'XRPLF/clio' && github.event_name != 'pull_request' }}
create_issue_on_failure:
needs: [build-and-test, nightly_release, build_and_publish_docker_image]

View File

@@ -27,7 +27,7 @@ jobs:
path: build
- name: Upload coverage report
if: ${{ hashFiles('build/coverage_report.xml') != '' }}
if: ${{ github.repository == 'XRPLF/clio' && hashFiles('build/coverage_report.xml') != '' }}
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
with:
files: build/coverage_report.xml

View File

@@ -74,7 +74,7 @@ jobs:
images: |
${{ needs.repo.outputs.GHCR_REPO }}/clio-gcc
${{ github.repository_owner == 'XRPLF' && 'rippleci/clio_gcc' || '' }}
push_image: ${{ github.event_name != 'pull_request' }}
push_image: ${{ github.repository == 'XRPLF/clio' && github.event_name != 'pull_request' }}
directory: docker/compilers/gcc
tags: |
type=raw,value=amd64-latest
@@ -112,7 +112,7 @@ jobs:
images: |
${{ needs.repo.outputs.GHCR_REPO }}/clio-gcc
${{ github.repository_owner == 'XRPLF' && 'rippleci/clio_gcc' || '' }}
push_image: ${{ github.event_name != 'pull_request' }}
push_image: ${{ github.repository == 'XRPLF/clio' && github.event_name != 'pull_request' }}
directory: docker/compilers/gcc
tags: |
type=raw,value=arm64-latest
@@ -201,7 +201,7 @@ jobs:
images: |
${{ needs.repo.outputs.GHCR_REPO }}/clio-clang
${{ github.repository_owner == 'XRPLF' && 'rippleci/clio_clang' || '' }}
push_image: ${{ github.event_name != 'pull_request' }}
push_image: ${{ github.repository == 'XRPLF/clio' && github.event_name != 'pull_request' }}
directory: docker/compilers/clang
tags: |
type=raw,value=latest
@@ -234,7 +234,7 @@ jobs:
with:
images: |
${{ needs.repo.outputs.GHCR_REPO }}/clio-tools
push_image: ${{ github.event_name != 'pull_request' }}
push_image: ${{ github.repository == 'XRPLF/clio' && github.event_name != 'pull_request' }}
directory: docker/tools
tags: |
type=raw,value=amd64-latest
@@ -265,7 +265,7 @@ jobs:
with:
images: |
${{ needs.repo.outputs.GHCR_REPO }}/clio-tools
push_image: ${{ github.event_name != 'pull_request' }}
push_image: ${{ github.repository == 'XRPLF/clio' && github.event_name != 'pull_request' }}
directory: docker/tools
tags: |
type=raw,value=arm64-latest
@@ -323,7 +323,7 @@ jobs:
with:
images: |
${{ needs.repo.outputs.GHCR_REPO }}/clio-pre-commit
push_image: ${{ github.event_name != 'pull_request' }}
push_image: ${{ github.repository == 'XRPLF/clio' && github.event_name != 'pull_request' }}
directory: docker/pre-commit
tags: |
type=raw,value=latest
@@ -348,7 +348,7 @@ jobs:
images: |
${{ needs.repo.outputs.GHCR_REPO }}/clio-ci
${{ github.repository_owner == 'XRPLF' && 'rippleci/clio_ci' || '' }}
push_image: ${{ github.event_name != 'pull_request' }}
push_image: ${{ github.repository == 'XRPLF/clio' && github.event_name != 'pull_request' }}
directory: docker/ci
tags: |
type=raw,value=latest

View File

@@ -101,12 +101,12 @@ jobs:
force_conan_source_build: ${{ github.event_name == 'schedule' || github.event.inputs.force_source_build == 'true' }}
build_type: ${{ matrix.build_type }}
- name: Login to Conan
if: ${{ github.repository_owner == 'XRPLF' && github.event_name != 'pull_request' }}
- name: Log into Conan remote
if: ${{ github.repository == 'XRPLF/clio' && github.event_name != 'pull_request' }}
run: conan remote login -p ${{ secrets.CONAN_PASSWORD }} xrplf ${{ secrets.CONAN_USERNAME }}
- name: Upload Conan packages
if: ${{ github.repository_owner == 'XRPLF' && github.event_name != 'pull_request' && github.event_name != 'schedule' }}
if: ${{ github.repository == 'XRPLF/clio' && github.event_name != 'pull_request' && github.event_name != 'schedule' }}
env:
FORCE_OPTION: ${{ github.event.inputs.force_upload == 'true' && '--force' || '' }}
run: conan upload "*" -r=xrplf --confirm ${FORCE_OPTION}