|
| 1 | +name: Create release |
| 2 | +description: Create release |
| 3 | + |
| 4 | +inputs: |
| 5 | + token: |
| 6 | + description: Token |
| 7 | + required: true |
| 8 | + deletePatterns: |
| 9 | + description: Pattern to delete old assets |
| 10 | + required: true |
| 11 | + uploadFiles: |
| 12 | + description: Files to upload |
| 13 | + required: true |
| 14 | + |
| 15 | +runs: |
| 16 | + using: composite |
| 17 | + steps: |
| 18 | + - name: Get release info |
| 19 | + id: release-info |
| 20 | + if: github.event.head_commit.message == 'increment build number' || github.ref_type == 'tag' |
| 21 | + uses: ./.github/actions/release-info |
| 22 | + |
| 23 | + - name: Delete old assets |
| 24 | + uses: mknejp/delete-release-assets@v1 |
| 25 | + if: steps.release-info.outputs.artifacts-tag && github.ref_type != 'tag' |
| 26 | + with: |
| 27 | + repository: ${{ |
| 28 | + (steps.release-info.outputs.artifacts-repository != github.repository && |
| 29 | + steps.release-info.outputs.artifacts-repository) || |
| 30 | + null |
| 31 | + }} |
| 32 | + token: ${{ |
| 33 | + (steps.release-info.outputs.artifacts-repository != github.repository && |
| 34 | + inputs.token) || |
| 35 | + github.token |
| 36 | + }} |
| 37 | + tag: ${{ steps.release-info.outputs.artifacts-tag }} |
| 38 | + fail-if-no-release: false |
| 39 | + fail-if-no-assets: false |
| 40 | + assets: ${{ inputs.deletePatterns }} |
| 41 | + |
| 42 | + - name: Release |
| 43 | + id: release_try1 |
| 44 | + uses: softprops/action-gh-release@master |
| 45 | + if: steps.release-info.outputs.artifacts-tag |
| 46 | + continue-on-error: true |
| 47 | + with: |
| 48 | + repository: ${{ |
| 49 | + (steps.release-info.outputs.artifacts-repository != github.repository && |
| 50 | + steps.release-info.outputs.artifacts-repository) || |
| 51 | + null |
| 52 | + }} |
| 53 | + token: ${{ |
| 54 | + (steps.release-info.outputs.artifacts-repository != github.repository && |
| 55 | + inputs.token) || |
| 56 | + github.token |
| 57 | + }} |
| 58 | + name: ${{ steps.release-info.outputs.artifacts-tag-description }} |
| 59 | + tag_name: ${{ steps.release-info.outputs.artifacts-tag }} |
| 60 | + prerelease: true |
| 61 | + overwrite_files: github.ref_type != 'tag' |
| 62 | + files: ${{ inputs.uploadFiles }} |
| 63 | + |
| 64 | + - name: Release (retry) |
| 65 | + uses: softprops/action-gh-release@master |
| 66 | + if: | |
| 67 | + steps.release-info.outputs.artifacts-tag && |
| 68 | + steps.release_try1.outcome == 'failure' |
| 69 | + with: |
| 70 | + repository: ${{ |
| 71 | + (steps.release-info.outputs.artifacts-repository != github.repository && |
| 72 | + steps.release-info.outputs.artifacts-repository) || |
| 73 | + null |
| 74 | + }} |
| 75 | + token: ${{ |
| 76 | + (steps.release-info.outputs.artifacts-repository != github.repository && |
| 77 | + inputs.token) || |
| 78 | + github.token |
| 79 | + }} |
| 80 | + name: ${{ steps.release-info.outputs.artifacts-tag-description }} |
| 81 | + tag_name: ${{ steps.release-info.outputs.artifacts-tag }} |
| 82 | + prerelease: true |
| 83 | + overwrite_files: github.ref_type != 'tag' |
| 84 | + files: ${{ inputs.uploadFiles }} |
0 commit comments