|
| 1 | +--- |
| 2 | +name: "tagged-release" |
| 3 | + |
| 4 | +on: |
| 5 | + push: |
| 6 | + tags: |
| 7 | + - "v*" |
| 8 | + |
| 9 | +jobs: |
| 10 | + tagged-release: |
| 11 | + name: "Tagged Release" |
| 12 | + runs-on: "ubuntu-latest" |
| 13 | + |
| 14 | + steps: |
| 15 | + # ... |
| 16 | + - uses: actions/checkout@master |
| 17 | + |
| 18 | + - name: "Make Step" |
| 19 | + run: | |
| 20 | + ./autogen.sh |
| 21 | + make dist |
| 22 | + echo "done!" |
| 23 | + |
| 24 | + - name: Get tar file |
| 25 | + id: get-tar-name |
| 26 | + run: echo "::set-output name=fileName::$(find . -type f -iname "*.tar.bz2" -printf "%f\n")" |
| 27 | + |
| 28 | + - name: Fetch tar file |
| 29 | + id: get-tar-path |
| 30 | + uses: Rishabh510/Path-lister-action@master |
| 31 | + with: |
| 32 | + path: "./" |
| 33 | + type: ".tar.bz2" |
| 34 | + |
| 35 | + - name: Create Release |
| 36 | + uses: "marvinpinto/action-automatic-releases@latest" |
| 37 | + id: release-create |
| 38 | + with: |
| 39 | + repo_token: "${{ secrets.GITHUB_TOKEN }}" |
| 40 | + prerelease: false |
| 41 | + |
| 42 | + - name: Generate md5 checksum |
| 43 | + uses: jmgilman/actions-generate-checksum@v1 |
| 44 | + with: |
| 45 | + method: md5 |
| 46 | + output: md5.txt |
| 47 | + patterns: ./*.tar.bz2 |
| 48 | + |
| 49 | + - name: Read md5 checksum file |
| 50 | + id: get-md5 |
| 51 | + run: echo "::set-output name=md5::$(sed -r 's/(.{32}).*/\1/' md5.txt;cat md5.txt)" |
| 52 | + |
| 53 | + - name: Generate sha1 checksum |
| 54 | + uses: jmgilman/actions-generate-checksum@v1 |
| 55 | + with: |
| 56 | + method: sha1 |
| 57 | + output: sha1.txt |
| 58 | + patterns: ./*.tar.bz2 |
| 59 | + |
| 60 | + - name: Read sha1 checksum file |
| 61 | + id: get-sha1 |
| 62 | + run: echo "::set-output name=sha1::$(sed -r 's/(.{40}).*/\1/' sha1.txt;cat sha1.txt)" |
| 63 | + |
| 64 | + - name: Generate sha256 checksum |
| 65 | + uses: jmgilman/actions-generate-checksum@v1 |
| 66 | + with: |
| 67 | + method: sha256 |
| 68 | + output: sha256.txt |
| 69 | + patterns: ./*.tar.bz2 |
| 70 | + |
| 71 | + - name: Read sha256 checksum file |
| 72 | + id: get-sha256 |
| 73 | + run: echo "::set-output name=sha256::$(sed -r 's/(.{64}).*/\1/' sha256.txt;cat sha256.txt)" |
| 74 | + |
| 75 | + - name: Upload Release Asset |
| 76 | + id: upload-main-asset |
| 77 | + uses: actions/upload-release-asset@v1 |
| 78 | + env: |
| 79 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 80 | + with: |
| 81 | + upload_url: ${{ steps.release-create.outputs.upload_url }} |
| 82 | + asset_path: ${{ steps.get-tar-path.outputs.paths }} |
| 83 | + asset_name: ${{ steps.get-tar-name.outputs.fileName }} |
| 84 | + asset_content_type: application/zip |
| 85 | + |
| 86 | + - name: Update Release |
| 87 | + id: update-release |
| 88 | + |
| 89 | + env: |
| 90 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 91 | + with: |
| 92 | + body: | |
| 93 | + **git tag: ${{ github.ref_name }}** |
| 94 | + ${{ steps.upload-main-asset.outputs.browser_download_url }} |
| 95 | + md5: ${{ steps.get-md5.outputs.md5 }} |
| 96 | + sha1: ${{ steps.get-sha1.outputs.sha1 }} |
| 97 | + sha256: ${{ steps.get-sha256.outputs.sha256 }} |
| 98 | + isAppendBody: true |
0 commit comments