Skip to content

Commit

Permalink
CI: Expose detected plugin name to other workflow jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
PatTheMav committed Dec 16, 2023
1 parent 620ff69 commit b4b38a8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/build-project.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Build Project
on:
workflow_call:
outputs:
pluginName:
description: 'Project name detected by parsing build spec file'
value: ${{ jobs.check-event.outputs.pluginName }}
jobs:
check-event:
name: Check GitHub Event Data 🔎
Expand All @@ -14,6 +18,7 @@ jobs:
notarize: ${{ steps.setup.outputs.notarize }}
config: ${{ steps.setup.outputs.config }}
commitHash: ${{ steps.setup.outputs.commitHash }}
pluginName: ${{ steps.setup.outputs.pluginName }}
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -57,6 +62,15 @@ jobs:
done
echo "commitHash=${GITHUB_SHA:0:9}" >> $GITHUB_OUTPUT
plugin_name="$(grep 'name' buildspec.json | sed -E -e 's/^.+"name":[^"]+"(.+)",?$/\1/g')"
plugin_display_name="$(grep 'displayName' buildspec.json | sed -E -e 's/^.+"displayName":[^"]+"(.+)",?$/\1/g')"
if [[ "${plugin_display_name}" ]]; then
echo "pluginName=${plugin_display_name}" >> $GITHUB_OUTPUT
else
echo "pluginName=${plugin_name}" >> $GITHUB_OUTPUT
fi
macos-build:
name: Build for macOS 🍏
runs-on: macos-13
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ jobs:
root_dir="$(pwd)"
commit_hash="${GITHUB_SHA:0:9}"
plugin_name="${{ needs.build-project.outputs.pluginName }}"
variants=(
'windows-x64;zip|exe'
Expand All @@ -84,7 +85,7 @@ jobs:
for variant_data in "${variants[@]}"; do
IFS=';' read -r variant suffix <<< "${variant_data}"
candidates=(*-${variant}-${commit_hash}/@(*|*-dbgsym).@(${suffix}))
candidates=(${plugin_name}-*-${variant}-${commit_hash}/@(*|*-dbgsym).@(${suffix}))
for candidate in "${candidates[@]}"; do
mv "${candidate}" "${root_dir}"
Expand All @@ -111,7 +112,7 @@ jobs:
draft: true
prerelease: ${{ fromJSON(steps.check.outputs.prerelease) }}
tag_name: ${{ steps.check.outputs.version }}
name: OBS Studio ${{ steps.check.outputs.version }}
name: ${{ needs.build-project.outputs.pluginName }} ${{ steps.check.outputs.version }}
body_path: ${{ github.workspace }}/CHECKSUMS.txt
files: |
${{ github.workspace }}/*.exe
Expand Down
1 change: 1 addition & 0 deletions buildspec.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
}
},
"name": "obs-plugintemplate",
"displayName": "OBS Plugin Template",
"version": "1.0.0",
"author": "Your Name Here",
"website": "https://example.com",
Expand Down

0 comments on commit b4b38a8

Please sign in to comment.