11name : Add Release Assets
22
3+ permissions :
4+ contents : write
5+
36on :
47 release :
58 types : [published]
69 workflow_dispatch :
7-
10+ inputs :
11+ tag :
12+ description : ' Tag to generate documentation for'
13+ required : true
14+ upload-on-workflow-dispatch :
15+ description : ' Upload assets?'
16+ required : false
17+ default : " false"
818jobs :
919 asset :
1020 runs-on : ${{ matrix.operating-system }}
1929 name : Get Tag
2030 run : echo ::set-output name=tag::${GITHUB_REF#refs/*/}
2131
22- - name : Get release
23- id : get_release
24- uses : bruceadams/get-release@v1.2.2
25- env :
26- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
27-
2832 - name : Checkout
2933 uses : actions/checkout@v2
3034
@@ -51,14 +55,12 @@ jobs:
5155 zip -d ${fileName} "tests*" || true &&
5256 zip -d ${fileName} "examples*" || true
5357 env :
54- fileName : google-api-php-client-${{ steps.tagName.outputs.tag }}-PHP${{ matrix.php }}.zip
58+ fileName : google-api-php-client-${{ inputs.tag || steps.tagName.outputs.tag }}-PHP${{ matrix.php }}.zip
5559
5660 - name : Upload Release Archive
57- uses : actions/upload-release-asset@v1
58- env :
59- GITHUB_TOKEN : ${{secrets.GITHUB_TOKEN}}
61+ uses : softprops/action-gh-release@v2
62+ if : github.ref_type == 'tag' || inputs.upload-on-workflow-dispatch == 'true'
6063 with :
61- upload_url : ${{ steps.get_release.outputs.upload_url }}
62- asset_path : ./google-api-php-client-${{ steps.tagName.outputs.tag }}-PHP${{ matrix.php }}.zip
63- asset_name : google-api-php-client-${{ steps.tagName.outputs.tag }}-PHP${{ matrix.php }}.zip
64- asset_content_type : application/zip
64+ tag_name : ${{ inputs.tag || steps.tagName.outputs.tag }}
65+ files : |
66+ ./google-api-php-client-${{ inputs.tag || steps.tagName.outputs.tag }}-PHP${{ matrix.php }}.zip
0 commit comments