Files
norouter/.github/workflows/release.yml
Akihiro Suda eaf15f6382 CI: Ubuntu 22.04
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-12-09 10:53:03 +09:00

59 lines
1.9 KiB
YAML

name: Release
on:
push:
tags:
- 'v*'
- 'test-action-release-*'
env:
GO111MODULE: on
jobs:
release:
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19.x
- uses: actions/checkout@v3
with:
path: go/src/github.com/norouter/norouter
- name: "Compile binaries"
working-directory: go/src/github.com/norouter/norouter
run: make cross
- name: "SHA256SUMS"
working-directory: go/src/github.com/norouter/norouter
run: ( cd ./artifacts; sha256sum norouter-* ) | tee /tmp/SHA256SUMS
- name: "The sha256sum of the SHA256SUMS file"
run: sha256sum /tmp/SHA256SUMS
- name: "Prepare the release note"
working-directory: go/src/github.com/norouter/norouter
run: |
tag="${GITHUB_REF##*/}"
shasha=$(sha256sum /tmp/SHA256SUMS | awk '{print $1}')
cat << EOF | tee /tmp/release-note.txt
${tag}
#### Changes
(To be documented)
#### Install
\`\`\`
curl -fsSL https://github.com/${{ github.repository }}/releases/download/${tag}/norouter-\$(uname -s)-\$(uname -m).tgz | sudo tar xzvC /usr/local/bin
\`\`\`
#### About the binaries
The binaries were built automatically on GitHub Actions.
The build log is available for 90 days: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
The sha256sum of the SHA256SUMS file itself is \`${shasha}\` .
EOF
- name: "Create release"
working-directory: go/src/github.com/norouter/norouter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag="${GITHUB_REF##*/}"
asset_flags=()
for f in ./artifacts/* /tmp/SHA256SUMS; do asset_flags+=("-a" "$f"); done
hub release create "${asset_flags[@]}" -F /tmp/release-note.txt --draft "${tag}"