44 workflow_dispatch :
55 inputs :
66 release_tag :
7- description : " GitHub release tag to publish (e.g. v13.1.1.1.0 )"
7+ description : " GitHub release tag to publish (e.g. v13.1.3.2 )"
88 type : string
99 required : true
1010 manifest_asset_name :
2222 required : true
2323 default : true
2424
25+ # Optional: allow reuse from other workflows
26+ workflow_call :
27+ inputs :
28+ release_tag : { type: string, required: true }
29+ manifest_asset_name : { type: string, required: true, default: module.json }
30+ notes_url : { type: string, required: false }
31+ dry_run : { type: boolean, required: true, default: true }
32+ secrets :
33+ FOUNDRY_PACKAGE_TOKEN :
34+ required : true
35+
2536jobs :
2637 publish :
2738 runs-on : ubuntu-latest
@@ -32,10 +43,23 @@ jobs:
3243 - name : Resolve release + manifest URL
3344 id : resolve
3445 uses : actions/github-script@v7
46+ env :
47+ # Works for both workflow_dispatch and workflow_call
48+ RELEASE_TAG : ${{ inputs.release_tag || github.event.inputs.release_tag }}
49+ MANIFEST_NAME : ${{ inputs.manifest_asset_name || github.event.inputs.manifest_asset_name }}
3550 with :
3651 script : |
37- const tag = core.getInput('release_tag', { required: true });
38- const manifestName = core.getInput('manifest_asset_name', { required: true });
52+ const tag = process.env.RELEASE_TAG;
53+ const manifestName = process.env.MANIFEST_NAME;
54+
55+ if (!tag) {
56+ core.setFailed('release_tag was not provided.');
57+ return;
58+ }
59+ if (!manifestName) {
60+ core.setFailed('manifest_asset_name was not provided.');
61+ return;
62+ }
3963
4064 const { data: rel } = await github.rest.repos.getReleaseByTag({
4165 owner: context.repo.owner,
5175
5276 core.setOutput('manifest_url', asset.browser_download_url);
5377 core.setOutput('release_html_url', rel.html_url);
78+ core.setOutput('tag', rel.tag_name);
5479
5580 - name : Fetch manifest and extract fields
5681 id : manifest
5984 sudo apt-get update -qq && sudo apt-get install -y -qq jq curl
6085 curl -fsSL "${{ steps.resolve.outputs.manifest_url }}" -o manifest.json
6186
62- # Required by Foundry API body:
6387 ID=$(jq -r '.id' manifest.json)
6488 VERSION=$(jq -r '.version' manifest.json)
6589 MIN=$(jq -r '.compatibility.minimum' manifest.json)
@@ -79,9 +103,11 @@ jobs:
79103
80104 - name : Determine notes URL
81105 id : notes
106+ env :
107+ NOTES_INPUT : ${{ inputs.notes_url || github.event.inputs.notes_url }}
82108 run : |
83- if [ -n "${{ inputs.notes_url } }" ]; then
84- echo "url=${{ inputs.notes_url } }" >> "$GITHUB_OUTPUT"
109+ if [ -n "${NOTES_INPUT }" ]; then
110+ echo "url=${NOTES_INPUT }" >> "$GITHUB_OUTPUT"
85111 else
86112 echo "url=${{ steps.resolve.outputs.release_html_url }}" >> "$GITHUB_OUTPUT"
87113 fi
96122 MIN : ${{ steps.manifest.outputs.minimum }}
97123 VER : ${{ steps.manifest.outputs.verified }}
98124 MAX : ${{ steps.manifest.outputs.maximum }}
99- DRY : ${{ inputs.dry_run }}
125+ DRY : ${{ inputs.dry_run || github.event.inputs.dry_run }}
100126 run : |
101127 set -euo pipefail
102128 if [ -z "${TOKEN:-}" ]; then
@@ -122,7 +148,7 @@ jobs:
122148 compatibility: {
123149 minimum: $minimum,
124150 verified: $verified,
125- maximum: $maximum
151+ maximum: ( $maximum // null)
126152 }
127153 }
128154 }')
@@ -140,8 +166,9 @@ jobs:
140166
141167 - name : Summary
142168 run : |
169+ echo "Tag: ${{ steps.resolve.outputs.tag }}" >> $GITHUB_STEP_SUMMARY
143170 echo "Package id: ${{ steps.manifest.outputs.id }}" >> $GITHUB_STEP_SUMMARY
144171 echo "Version: ${{ steps.manifest.outputs.version }}" >> $GITHUB_STEP_SUMMARY
145172 echo "Manifest: ${{ steps.resolve.outputs.manifest_url }}" >> $GITHUB_STEP_SUMMARY
146173 echo "Notes: ${{ steps.notes.outputs.url }}" >> $GITHUB_STEP_SUMMARY
147- echo "Dry run: ${{ inputs.dry_run }}" >> $GITHUB_STEP_SUMMARY
174+ echo "Dry run: ${{ inputs.dry_run || github.event.inputs.dry_run }}" >> $GITHUB_STEP_SUMMARY
0 commit comments