|
| 1 | +name: upload artifact |
| 2 | +description: "upload generated artifacts including release" |
| 3 | +inputs: |
| 4 | + artifact_name: |
| 5 | + description: "name of the artifact" |
| 6 | + default: "tegola" |
| 7 | + required: false |
| 8 | + upload_postfix: |
| 9 | + description: "uploaded name of the artifact" |
| 10 | + default: "linux_amd64" |
| 11 | + required: false |
| 12 | + github_token: |
| 13 | + description: "github token" |
| 14 | + required: true |
| 15 | + |
| 16 | +runs: |
| 17 | + using: "composite" |
| 18 | + steps: |
| 19 | + - id: zip-path |
| 20 | + uses: ./.github/actions/tegola_upload_path |
| 21 | + with: |
| 22 | + name: ${{ inputs.artifact_name }} |
| 23 | + |
| 24 | + # workaround for archives losing permissions |
| 25 | + # https://github.com/actions/upload-artifact/issues/38 |
| 26 | + - name: Zip (not windows) |
| 27 | + run: | |
| 28 | + cd ${{steps.zip-path.outputs.dir-path}} |
| 29 | + zip -9 -D tegola.zip ${{inputs.artifact_name}} |
| 30 | + shell: bash |
| 31 | + if: ${{ runner.os != 'Windows' }} |
| 32 | + |
| 33 | + - name: Zip (windows) |
| 34 | + run: | |
| 35 | + cd ${{steps.zip-path.outputs.dir-path}} |
| 36 | + 7z a tegola.zip ${{inputs.artifact_name}}.exe |
| 37 | + shell: pwsh |
| 38 | + if: ${{ runner.os == 'Windows' }} |
| 39 | + |
| 40 | + - name: Upload build artifacts |
| 41 | + uses: actions/upload-artifact@v2 |
| 42 | + with: |
| 43 | + name: ${{inputs.artifact_name}}${{inputs.upload_postfix}} |
| 44 | + path: ${{steps.zip-path.outputs.dir-path}}tegola.zip |
| 45 | + |
| 46 | + - name: Upload release asset |
| 47 | + if: github.event_name == 'release' |
| 48 | + uses: actions/upload-release-asset@v1 |
| 49 | + env: |
| 50 | + GITHUB_TOKEN: ${{ inputs.github_token }} |
| 51 | + with: |
| 52 | + upload_url: ${{ github.event.release.upload_url }} |
| 53 | + asset_path: ${{steps.zip-path.outputs.dir-path}}tegola.zip |
| 54 | + asset_name: ${{inputs.artifact_name}}${{inputs.upload_postfix}}.zip |
| 55 | + asset_content_type: application/zip |
0 commit comments