@@ -3,6 +3,11 @@ name: '🎁 Release'
33on :
44 workflow_dispatch :
55 inputs :
6+ job-id :
7+ default : ' all'
8+ type : choice
9+ options : ['all', 'publish-package', 'publish-docs']
10+
611 dry-run :
712 required : false
813 default : true
1520 config-prep :
1621 runs-on : ubuntu-latest
1722 outputs :
23+ publish-package : ${{ steps.debug.outputs.publish-package }}
24+ publish-docs : ${{ steps.debug.outputs.publish-docs }}
1825 dry-run : ${{ github.event_name == 'workflow_dispatch' && inputs.dry-run }}
1926 enable-docs : ${{ steps.read-file.outputs.content }}
2027 steps :
28+ - name : Debug
29+ id : debug
30+ shell : bash
31+ run : |
32+ value=${{ github.event_name != 'workflow_dispatch' || contains(fromJson('["all", "publish-package"]'), inputs.job-id) }}
33+ echo "publish-package=${value}" >> $GITHUB_OUTPUT
34+ value=${{ github.event_name != 'workflow_dispatch' || contains(fromJson('["all", "publish-docs"]'), inputs.job-id) }}
35+ echo "publish-docs=${value}" >> $GITHUB_OUTPUT
36+
2137 - name : Checkout
2238 uses : actions/checkout@v3
2339
@@ -30,44 +46,43 @@ jobs:
3046
3147 publish-package :
3248 needs : config-prep
49+ if : needs.config-prep.outputs.publish-package == 'true'
3350 uses : ./.github/workflows/testpypi.yml
3451 with :
3552 dry-run : ${{ fromJson(needs.config-prep.outputs.dry-run) }}
3653 secrets : inherit
3754
3855 publish-docs :
39- needs : [config-prep, publish-package]
40- if : needs.config-prep.outputs.enable-docs == 'true'
56+ needs : config-prep
57+ if : needs.config-prep.outputs.publish-docs == 'true' &&
58+ needs.config-prep.outputs.enable-docs == 'true'
4159 uses : ./.github/workflows/docs.yml
4260 with :
4361 dry-run : ${{ fromJson(needs.config-prep.outputs.dry-run) }}
4462
4563 report :
64+ if : ${{ ! failure() }}
4665 needs : [publish-package, publish-docs]
4766 runs-on : ubuntu-latest
4867 steps :
49- - name : Debug
50- shell : bash
51- run : |
52- echo ${{ needs.publish-package.result }}
53- echo ${{ needs.publish-docs.result }}
54-
5568 - name : Generate a summary
5669 uses : actions/github-script@v6
5770 with :
5871 script : |
59- const name_to_url = new Map([
60- ['TestPyPI', '${{ needs.publish-package.outputs.page-url }}'],
61- ]);
72+ const name_to_url = new Map();
73+ if ('${{ needs.publish-package.outputs.page-url }}' != '') {
74+ name_to_url.set('TestPyPI', '${{ needs.publish-package.outputs.page-url }}');
75+ }
6276 if ('${{ needs.publish-docs.outputs.page-url }}' != '') {
6377 name_to_url.set('GitHub Pages', '${{ needs.publish-docs.outputs.page-url }}');
6478 }
6579
6680 const list = [...name_to_url].map(([name, url]) =>
6781 `<a href="${url}">${name}</a>`
6882 );
83+ const title = list.length ? 'Links to published content' : 'Nothing has been published';
6984
7085 await core.summary
71- .addHeading('Links to published content' )
86+ .addHeading(title )
7287 .addList(list)
7388 .write()
0 commit comments