|
| 1 | +# This script is provided by github.com/bool64/dev. |
| 2 | + |
| 3 | +# This script uploads application binaries as GitHub release assets. |
| 4 | +name: release-assets |
| 5 | +on: |
| 6 | + release: |
| 7 | + types: |
| 8 | + - created |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: write # Required to upload assets |
| 12 | + |
| 13 | +env: |
| 14 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 15 | + GO_VERSION: stable |
| 16 | + TAG_NAME: ${{ github.event.release.tag_name }} |
| 17 | +jobs: |
| 18 | + build: |
| 19 | + name: Upload Release Assets |
| 20 | + runs-on: ubuntu-latest |
| 21 | + steps: |
| 22 | + - name: Install Go |
| 23 | + uses: actions/setup-go@v5 |
| 24 | + with: |
| 25 | + go-version: ${{ env.GO_VERSION }} |
| 26 | + - name: Checkout code |
| 27 | + uses: actions/checkout@v4 |
| 28 | + - name: Build artifacts |
| 29 | + run: | |
| 30 | + make release-assets |
| 31 | +
|
| 32 | + - name: Upload linux_amd64.tar.gz |
| 33 | + if: hashFiles('linux_amd64.tar.gz') != '' |
| 34 | + run: gh release upload "$TAG_NAME" linux_amd64.tar.gz --clobber |
| 35 | + |
| 36 | + - name: Upload linux_amd64_dbg.tar.gz |
| 37 | + if: hashFiles('linux_amd64_dbg.tar.gz') != '' |
| 38 | + run: gh release upload "$TAG_NAME" linux_amd64_dbg.tar.gz --clobber |
| 39 | + |
| 40 | + - name: Upload linux_arm64.tar.gz |
| 41 | + if: hashFiles('linux_arm64.tar.gz') != '' |
| 42 | + run: gh release upload "$TAG_NAME" linux_arm64.tar.gz --clobber |
| 43 | + |
| 44 | + - name: Upload linux_arm.tar.gz |
| 45 | + if: hashFiles('linux_arm.tar.gz') != '' |
| 46 | + run: gh release upload "$TAG_NAME" linux_arm.tar.gz --clobber |
| 47 | + |
| 48 | + - name: Upload darwin_amd64.tar.gz |
| 49 | + if: hashFiles('darwin_amd64.tar.gz') != '' |
| 50 | + run: gh release upload "$TAG_NAME" darwin_amd64.tar.gz --clobber |
| 51 | + |
| 52 | + - name: Upload darwin_arm64.tar.gz |
| 53 | + if: hashFiles('darwin_arm64.tar.gz') != '' |
| 54 | + run: gh release upload "$TAG_NAME" darwin_arm64.tar.gz --clobber |
| 55 | + |
| 56 | + - name: Upload windows_amd64.zip |
| 57 | + if: hashFiles('windows_amd64.zip') != '' |
| 58 | + run: gh release upload "$TAG_NAME" windows_amd64.zip --clobber |
0 commit comments