-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
ab4822a
commit 3c55b67
Showing
9 changed files
with
2,797 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env bash | ||
checksum() { | ||
echo $(sha256sum $@ | awk '{print $1}') | ||
} | ||
change_log_file="./CHANGELOG.md" | ||
version="## $@" | ||
version_prefix="## " | ||
start=0 | ||
CHANGE_LOG="" | ||
while read line; do | ||
if [[ $line == *"$version_prefix"* ]] && [ $start == 0 ]; then | ||
start=1 | ||
continue | ||
fi | ||
if [[ $line == *"$version_prefix"* ]] && [ $start == 1 ]; then | ||
break; | ||
fi | ||
if [ $start == 1 ]; then | ||
CHANGE_LOG+="$line\n" | ||
fi | ||
done < ${change_log_file} | ||
MAINNET_ZIP_SUM="$(checksum mainnet_config.zip)" | ||
TESTNET_ZIP_SUM="$(checksum testnet_config.zip)" | ||
LINUX_BIN_SUM="$(checksum linux_binary.zip)" | ||
MAC_BIN_SUM="$(checksum macos_binary.zip)" | ||
WINDOWS_BIN_SUM="$(checksum windows_binary.zip)" | ||
OUTPUT=$(cat <<-END | ||
## Changelog\n | ||
${CHANGE_LOG}\n | ||
## Assets\n | ||
| Assets | Sha256 Checksum |\n | ||
| :-----------: |------------|\n | ||
| mainnet_config.zip | ${MAINNET_ZIP_SUM} |\n | ||
| testnet_config.zip | ${TESTNET_ZIP_SUM} |\n | ||
| linux_binary.zip | ${LINUX_BIN_SUM} |\n | ||
| macos_binary.zip | ${MAC_BIN_SUM} |\n | ||
| windows_binary.zip | ${WINDOWS_BIN_SUM} |\n | ||
END | ||
) | ||
echo -e ${OUTPUT} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
name: pre-release | ||
|
||
on: | ||
push: | ||
# Publish `pre-v1.2.3` tags as releases. | ||
tags: | ||
- pre-v* | ||
|
||
jobs: | ||
build: | ||
name: Build Release | ||
strategy: | ||
matrix: | ||
go-version: [1.16.x] | ||
os: [ubuntu-18.04, macos-11, windows-2019] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
|
||
- uses: actions/cache@v2 | ||
with: | ||
# In order: | ||
# * Module download cache | ||
# * Build cache (Linux) | ||
# * Build cache (Mac) | ||
# * Build cache (Windows) | ||
path: | | ||
~/go/pkg/mod | ||
~/.cache/go-build | ||
~/Library/Caches/go-build | ||
%LocalAppData%\go-build | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- run: go env -w GOPRIVATE="github.com/bnb-chain/*" | ||
- run: git config --global url."https://${{ secrets.GH_ACCESS_TOKEN }}@github.com".insteadOf "https://github.com" | ||
|
||
# ============================== | ||
# Linux/Macos/Windows Build | ||
# ============================== | ||
|
||
# used to debug workflow | ||
# - name: Setup tmate session | ||
# uses: mxschmitt/action-tmate@v3 | ||
|
||
- name: Build Binary for ${{matrix.os}} | ||
run: make build | ||
|
||
# ============================== | ||
# Upload artifacts | ||
# ============================== | ||
|
||
- name: Upload Linux Build | ||
uses: actions/upload-artifact@v2 | ||
if: matrix.os == 'ubuntu-18.04' | ||
with: | ||
name: linux | ||
path: ./build | ||
|
||
- name: Upload MacOS Build | ||
uses: actions/upload-artifact@v2 | ||
if: matrix.os == 'macos-11' | ||
with: | ||
name: macos | ||
path: ./build | ||
|
||
- name: Upload Windows Build | ||
uses: actions/upload-artifact@v2 | ||
if: matrix.os == 'windows-2019' | ||
with: | ||
name: windows | ||
path: ./build | ||
|
||
release: | ||
name: Release | ||
needs: build | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v2 | ||
|
||
# ============================== | ||
# Download artifacts | ||
# ============================== | ||
|
||
- name: Download Artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: linux | ||
path: ./linux | ||
|
||
- name: Download Artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: macos | ||
path: ./macos | ||
|
||
- name: Download Artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: windows | ||
path: ./windows | ||
|
||
- run: zip -r linux_binary.zip linux | ||
- run: zip -r macos_binary.zip macos | ||
- run: zip -r windows_binary.zip windows | ||
- run: zip -r mainnet_config.zip asset/mainnet | ||
- run: zip -r testnet_config.zip asset/testnet | ||
|
||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | ||
with: | ||
tag_name: ${{ github.ref_name }} | ||
release_name: ${{ github.ref_name }} | ||
body: | | ||
git commit: ${{ github.sha }} | ||
draft: true | ||
prerelease: true | ||
|
||
# Check downloaded files | ||
- run: ls | ||
|
||
- name: Upload Release Asset - Linux | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | ||
asset_path: ./linux_binary.zip | ||
asset_name: linux_binary.zip | ||
asset_content_type: application/octet-stream | ||
|
||
- name: Upload Release Asset - MacOS | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | ||
asset_path: ./macos_binary.zip | ||
asset_name: macos_binary.zip | ||
asset_content_type: application/octet-stream | ||
|
||
- name: Upload Release Asset - Windows | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | ||
asset_path: ./windows_binary.zip | ||
asset_name: windows_binary.zip | ||
asset_content_type: application/octet-stream | ||
|
||
- name: Upload Mainnet Config | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | ||
asset_path: ./mainnet_config.zip | ||
asset_name: mainnet_config.zip | ||
asset_content_type: application/octet-stream | ||
|
||
- name: Upload Testnet Config | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | ||
asset_path: ./testnet_config.zip | ||
asset_name: testnet_config.zip | ||
asset_content_type: application/octet-stream |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.