Jelajahi Sumber

CI: Expose detected plugin name to other workflow jobs

PatTheMav 1 tahun lalu
induk
melakukan
bebefd4440
3 mengubah file dengan 16 tambahan dan 1 penghapusan
  1. 14 0
      .github/workflows/build-project.yaml
  2. 1 1
      .github/workflows/push.yaml
  3. 1 0
      buildspec.json

+ 14 - 0
.github/workflows/build-project.yaml

@@ -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 🔎
@@ -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:
@@ -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' || echo "")"
+
+          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

+ 1 - 1
.github/workflows/push.yaml

@@ -111,7 +111,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

+ 1 - 0
buildspec.json

@@ -37,6 +37,7 @@
         }
     },
     "name": "obs-plugintemplate",
+    "displayName": "OBS Plugin Template",
     "version": "1.0.0",
     "author": "Your Name Here",
     "website": "https://example.com",