Skip to content

Commit

Permalink
Fix workflow_call
Browse files Browse the repository at this point in the history
  • Loading branch information
dixyes committed Oct 1, 2023
1 parent 0df3ad0 commit 27fe450
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 31 deletions.
37 changes: 23 additions & 14 deletions .github/workflows/linux-new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,23 @@ on:
required: false
type: boolean
default: false
workflowRepo:
description: "repository of workflow to call"
required: true
type: string
workflowRev:
description: "revision of workflow to call"
required: true
type: string

jobs:
gen-jobs:
name: Generate jobs
runs-on: ubuntu-latest
outputs:
jobs: ${{ steps.gen-jobs.outputs.jobs }}
permissions:
contents: write
steps:
- name: Generate jobs
id: gen-jobs
Expand All @@ -96,7 +106,7 @@ jobs:
throw new ErrorException($message, 0, $severity, $file, $line);
});
if (${{ github.event.inputs.uploadRelease }}) {
if (${{ inputs.uploadRelease }}) {
# create github release
echo "create release\n";
Expand Down Expand Up @@ -128,19 +138,19 @@ jobs:
}
$flavors = arg2arr(<<<'ARG'
${{ github.event.inputs.flavors }}
${{ inputs.flavors }}
ARG);
$archs = arg2arr(<<<'ARG'
${{ github.event.inputs.archs }}
${{ inputs.archs }}
ARG);
$sapis = arg2arr(<<<'ARG'
${{ github.event.inputs.sapis }}
${{ inputs.sapis }}
ARG);
$libcs = arg2arr(<<<'ARG'
${{ github.event.inputs.libcs }}
${{ inputs.libcs }}
ARG);
$phpVers = arg2arr(<<<'ARG'
${{ github.event.inputs.phpVers }}
${{ inputs.phpVers }}
ARG);
if (!$flavors) {
Expand All @@ -160,10 +170,10 @@ jobs:
}
$customLibraries = <<<'ARG'
${{ github.event.inputs.customLibraries }}
${{ inputs.customLibraries }}
ARG;
$customExtensions = <<<'ARG'
${{ github.event.inputs.customExtensions }}
${{ inputs.customExtensions }}
ARG;
$customLibraries = trim($customLibraries);
$customExtensions = trim($customExtensions);
Expand Down Expand Up @@ -224,6 +234,8 @@ jobs:
container: 'ghcr.io/dixyes/prepared-lwmbs:${{ matrix.imageTag }}'
needs:
- gen-jobs
permissions:
contents: write
strategy:
max-parallel: 6
fail-fast: false
Expand All @@ -248,13 +260,10 @@ jobs:
export GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}"
# prepare lwmbs
remote="${{ github.repositoryUrl }}"
# git: is not available in actions
remote="https:${remote#git:}"
cd /lwmbs
git remote set-url origin "$remote"
git fetch origin ${{ github.sha }}
git checkout ${{ github.sha }}
git remote set-url origin "https://github.com/${{ inputs.workflowRepo || github.repository }}"
git fetch origin ${{ inputs.workflowRev || github.sha }}
git checkout ${{ inputs.workflowRev || github.sha }}
cd /
php /lwmbs/fetch_source.php \
Expand Down
29 changes: 22 additions & 7 deletions .github/workflows/macos-new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,23 @@ on:
required: false
type: boolean
default: false
workflowRepo:
description: "repository of workflow to call"
required: true
type: string
workflowRev:
description: "revision of workflow to call"
required: true
type: string

jobs:
gen-jobs:
name: Generate jobs
runs-on: macos-latest
outputs:
jobs: ${{ steps.gen-jobs.outputs.jobs }}
permissions:
contents: write
steps:
- name: Generate jobs
id: gen-jobs
Expand All @@ -87,7 +97,7 @@ jobs:
throw new ErrorException($message, 0, $severity, $file, $line);
});
if (${{ github.event.inputs.uploadRelease }}) {
if (${{ inputs.uploadRelease }}) {
# create github release
echo "create release\n";
Expand Down Expand Up @@ -119,16 +129,16 @@ jobs:
}
$flavors = arg2arr(<<<'ARG'
${{ github.event.inputs.flavors }}
${{ inputs.flavors }}
ARG);
$archs = arg2arr(<<<'ARG'
${{ github.event.inputs.archs }}
${{ inputs.archs }}
ARG);
$sapis = arg2arr(<<<'ARG'
${{ github.event.inputs.sapis }}
${{ inputs.sapis }}
ARG);
$phpVers = arg2arr(<<<'ARG'
${{ github.event.inputs.phpVers }}
${{ inputs.phpVers }}
ARG);
if (!$flavors) {
Expand All @@ -145,10 +155,10 @@ jobs:
}
$customLibraries = <<<'ARG'
${{ github.event.inputs.customLibraries }}
${{ inputs.customLibraries }}
ARG;
$customExtensions = <<<'ARG'
${{ github.event.inputs.customExtensions }}
${{ inputs.customExtensions }}
ARG;
$customLibraries = trim($customLibraries);
$customExtensions = trim($customExtensions);
Expand Down Expand Up @@ -196,6 +206,8 @@ jobs:
runs-on: macos-latest
needs:
- gen-jobs
permissions:
contents: write
strategy:
max-parallel: 3
fail-fast: false
Expand All @@ -204,6 +216,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
repository: ${{ inputs.workflowRepo || github.repository }}
ref: ${{ inputs.workflowRev || github.sha }}

- name: Restore sources
uses: actions/cache/restore@v3
Expand Down
32 changes: 22 additions & 10 deletions .github/workflows/windows-new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,23 @@ on:
required: false
type: boolean
default: false
workflowRepo:
description: "repository of workflow to call"
required: true
type: string
workflowRev:
description: "revision of workflow to call"
required: true
type: string

jobs:
gen-jobs:
name: Generate jobs
runs-on: windows-latest
outputs:
jobs: ${{ steps.gen-jobs.outputs.jobs }}
permissions:
contents: write
steps:
- name: Generate jobs
id: gen-jobs
Expand All @@ -87,7 +97,7 @@ jobs:
throw new ErrorException($message, 0, $severity, $file, $line);
});
if (${{ github.event.inputs.uploadRelease }}) {
if (${{ inputs.uploadRelease }}) {
# create github release
echo "create release\n";
Expand Down Expand Up @@ -119,16 +129,16 @@ jobs:
}
$flavors = arg2arr(<<<'ARG'
${{ github.event.inputs.flavors }}
${{ inputs.flavors }}
ARG);
$archs = arg2arr(<<<'ARG'
${{ github.event.inputs.archs }}
${{ inputs.archs }}
ARG);
$sapis = arg2arr(<<<'ARG'
${{ github.event.inputs.sapis }}
${{ inputs.sapis }}
ARG);
$phpVers = arg2arr(<<<'ARG'
${{ github.event.inputs.phpVers }}
${{ inputs.phpVers }}
ARG);
if (!$flavors) {
Expand All @@ -145,10 +155,10 @@ jobs:
}
$customLibraries = <<<'ARG'
${{ github.event.inputs.customLibraries }}
${{ inputs.customLibraries }}
ARG;
$customExtensions = <<<'ARG'
${{ github.event.inputs.customExtensions }}
${{ inputs.customExtensions }}
ARG;
$customLibraries = trim($customLibraries);
$customExtensions = trim($customExtensions);
Expand Down Expand Up @@ -203,6 +213,8 @@ jobs:
# container: "ghcr.io/dixyes/prepared-lwmbs:windows-${{ matrix.arch }}-src"
needs:
- gen-jobs
permissions:
contents: write
strategy:
max-parallel: 3
fail-fast: false
Expand Down Expand Up @@ -236,15 +248,15 @@ jobs:
if (0 -Ne $lastexitcode) {
exit 1
}
git remote add origin https://github.com/${{ github.repository }}
git remote add origin https://github.com/${{ inputs.workflowRepo || github.repository }}
if (0 -Ne $lastexitcode) {
exit 1
}
git fetch --depth 1 origin ${{ github.sha }}
git fetch --depth 1 origin ${{ inputs.workflowRev || github.sha }}
if (0 -Ne $lastexitcode) {
exit 1
}
git checkout ${{ github.sha }}
git checkout ${{ inputs.workflowRev || github.sha }}
if (0 -Ne $lastexitcode) {
exit 1
}
Expand Down

0 comments on commit 27fe450

Please sign in to comment.