|
| 1 | +name: Release |
| 2 | +on: |
| 3 | + push: |
| 4 | + tags: |
| 5 | + - 'v*' |
| 6 | + - 'test-action-release-*' |
| 7 | +env: |
| 8 | + GO111MODULE: on |
| 9 | +jobs: |
| 10 | + release: |
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + go-version: [1.15.x] |
| 14 | + os: [ubuntu-20.04] |
| 15 | + runs-on: ${{ matrix.os }} |
| 16 | + timeout-minutes: 20 |
| 17 | + steps: |
| 18 | + - uses: actions/setup-go@v2 |
| 19 | + with: |
| 20 | + go-version: ${{ matrix.go-version }} |
| 21 | + - uses: actions/checkout@v2 |
| 22 | + with: |
| 23 | + path: go/src/github.com/AkihiroSuda/sshocker |
| 24 | + - name: "Compile binaries" |
| 25 | + working-directory: go/src/github.com/AkihiroSuda/sshocker |
| 26 | + run: make cross |
| 27 | + - name: "SHA256SUMS" |
| 28 | + working-directory: go/src/github.com/AkihiroSuda/sshocker |
| 29 | + run: ( cd ./bin; sha256sum sshocker-* ) | tee /tmp/SHA256SUMS |
| 30 | + - name: "Prepare the release note" |
| 31 | + working-directory: go/src/github.com/AkihiroSuda/sshocker |
| 32 | + run: | |
| 33 | + tag="${GITHUB_REF##*/}" |
| 34 | + cat << EOF | tee /tmp/release-note.txt |
| 35 | + ${tag} |
| 36 | +
|
| 37 | + #### Changes |
| 38 | + (To be documented) |
| 39 | +
|
| 40 | + #### Install |
| 41 | + \`\`\` |
| 42 | + curl -o sshocker --fail -L https://github.com/${{ github.repository }}/releases/download/${tag}/sshocker-\$(uname -s)-\$(uname -m) |
| 43 | + chmod +x sshocker |
| 44 | + \`\`\` |
| 45 | +
|
| 46 | + #### About the binaries |
| 47 | + The binaries were built automatically on GitHub Actions. |
| 48 | + See the log to verify SHA256SUMS. |
| 49 | + https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} |
| 50 | + EOF |
| 51 | + - name: "Create release" |
| 52 | + working-directory: go/src/github.com/AkihiroSuda/sshocker |
| 53 | + env: |
| 54 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 55 | + run: | |
| 56 | + tag="${GITHUB_REF##*/}" |
| 57 | + asset_flags=() |
| 58 | + for f in ./bin/* /tmp/SHA256SUMS; do asset_flags+=("-a" "$f"); done |
| 59 | + hub release create "${asset_flags[@]}" -F /tmp/release-note.txt --draft "${tag}" |
0 commit comments