@@ -32,32 +32,57 @@ jobs:
3232 config-file : release-please-config.json
3333 manifest-file : .release-please-manifest.json
3434
35+ download-artifacts :
36+ needs : release-please
37+ if : needs.release-please.outputs.release_created == 'true'
38+ runs-on : ubuntu-latest
39+ outputs :
40+ artifacts_found : ${{ steps.check-artifacts.outputs.artifacts_found }}
41+
42+ steps :
3543 - name : Download workflow artifacts
3644 uses : dawidd6/action-download-artifact@v6
3745 with :
3846 workflow : build.yml
3947 workflow_conclusion : success
4048 branch : ${{ github.event_name == 'push' && github.ref_name || github.event.workflow_run.head_branch }}
4149 path : artifacts
42- if_no_artifact_found : fail
50+ if_no_artifact_found : warn
4351
44- - name : Wait for assets to be created
45- id : wait-for-assets
52+ - name : Check for artifacts
53+ id : check-artifacts
4654 run : |
47- while [ ! -d "artifacts" ] || [ -z "$(ls -A artifacts)" ]; do
48- echo "Waiting for assets to be created..."
49- sleep 10
50- done
55+ if [ -d "artifacts" ] && [ "$(ls -A artifacts)" ]; then
56+ echo "artifacts_found=true" >> $GITHUB_OUTPUT
57+ else
58+ echo "artifacts_found=false" >> $GITHUB_OUTPUT
59+ fi
60+
61+ - name : Upload artifacts
62+ uses : actions/upload-artifact@v3
63+ if : steps.check-artifacts.outputs.artifacts_found == 'true'
64+ with :
65+ name : release-artifacts
66+ path : artifacts
67+
68+ upload-release-assets :
69+ needs : [release-please, download-artifacts]
70+ if : >
71+ needs.release-please.outputs.release_created == 'true' &&
72+ needs.download-artifacts.outputs.artifacts_found == 'true'
73+ runs-on : ubuntu-latest
74+
75+ steps :
76+ - name : Download artifacts
77+ uses : actions/download-artifact@v3
78+ with :
79+ name : release-artifacts
80+ path : artifacts
5181
5282 - name : Upload Release Assets
53- if : steps.wait-for-assets.outputs.exit_code == '0'
5483 env :
5584 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
5685 run : |
57- if [ -d "artifacts" ] && [ "$(ls -A artifacts)" ]; then
58- for file in artifacts/*/*.zip; do
59- gh release upload ${{ steps.release.outputs.tag_name }} "$file" --clobber
60- done
61- else
62- echo "No artifacts found to upload"
63- fi
86+ for file in artifacts/*/*.zip; do
87+ gh release upload ${{ needs.release-please.outputs.tag_name }} $file --clobber
88+ done
0 commit comments