-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
168 additions
and
62 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,36 @@ | ||
#!/usr/bin/env bash | ||
checksum() { | ||
echo $(sha256sum $@ | awk '{print $1}') | ||
} | ||
change_log_file="./CHANGELOG.md" | ||
version="## $@" | ||
version_prefix="## v" | ||
start=0 | ||
CHANGE_LOG="" | ||
while read line; do | ||
if [[ $line == *"$version"* ]]; 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} | ||
LINUX_BIN_SUM="$(checksum ./linux/linux)" | ||
MAC_BIN_SUM="$(checksum ./macos/macos)" | ||
WINDOWS_BIN_SUM="$(checksum ./windows/windows.exe)" | ||
OUTPUT=$(cat <<-END | ||
${CHANGE_LOG}\n | ||
## Assets\n | ||
| Assets | Sha256 Checksum |\n | ||
| :-----------: |------------|\n | ||
| linux | ${LINUX_BIN_SUM} |\n | ||
| mac | ${MAC_BIN_SUM} |\n | ||
| windows | ${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
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 |
---|---|---|
|
@@ -18,7 +18,7 @@ jobs: | |
strategy: | ||
matrix: | ||
go-version: [1.18.x] | ||
os: [ubuntu-18.04] | ||
os: [ubuntu-latest] | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
GOPRIVATE: github.com/bnb-chain | ||
|
@@ -30,7 +30,7 @@ jobs: | |
- uses: actions/checkout@v3 | ||
- name: Setup GitHub Token | ||
run: git config --global url.https://[email protected]/.insteadOf https://github.com/ | ||
- uses: actions/cache@v2 | ||
- uses: actions/cache@v3 | ||
with: | ||
# In order: | ||
# * Module download cache | ||
|
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 |
---|---|---|
@@ -1,57 +1,128 @@ | ||
# This workflow is useful if you want to automate the process of: | ||
# | ||
# a) Creating a new prelease when you push a new tag with a "v" prefix (version). | ||
# | ||
# This type of prerelease is meant to be used for production: alpha, beta, rc, etc. types of releases. | ||
# After the prerelease is created, you need to make your changes on the release page at the relevant | ||
# Github page and publish your release. | ||
# | ||
# b) Creating/updating the "latest" prerelease when you push to your default branch. | ||
# | ||
# This type of prelease is useful to make your bleeding-edge binaries available to advanced users. | ||
# | ||
# The workflow will not run if there is no tag pushed with a "v" prefix and no change pushed to your | ||
# default branch. | ||
name: Release | ||
|
||
on: | ||
push: | ||
# Publish `v1.2.3` tags as releases. | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
might_release: | ||
runs-on: ubuntu-latest | ||
build: | ||
name: Build Release | ||
strategy: | ||
matrix: | ||
go-version: [1.18.x] | ||
os: [ubuntu-latest, macos-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Prepare Release Variables | ||
id: vars | ||
uses: ignite/cli/actions/release/vars@develop | ||
|
||
- name: Issue Release Assets | ||
uses: ignite/cli/actions/cli@develop | ||
if: ${{ steps.vars.outputs.should_release == 'true' }} | ||
go-version: ${{ matrix.go-version }} | ||
|
||
- uses: actions/cache@v3 | ||
with: | ||
args: chain build --release --release.prefix ${{ steps.vars.outputs.tarball_prefix }} -t linux:amd64 -t darwin:amd64 -t darwin:arm64 | ||
# 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 | ||
~\AppData\Local\go-build | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Setup GitHub Token | ||
run: git config --global url.https://${{ secrets.GH_ACCESS_SECRET }}@github.com/.insteadOf https://github.com/ | ||
|
||
# ============================== | ||
# Linux/Macos Build | ||
# ============================== | ||
|
||
- name: Delete the "latest" Release | ||
uses: dev-drprasad/[email protected] | ||
if: ${{ steps.vars.outputs.is_release_type_latest == 'true' }} | ||
- name: Build Binary for ${{matrix.os}} | ||
run: | | ||
make build | ||
# ============================== | ||
# Upload artifacts | ||
# ============================== | ||
|
||
- name: Upload Linux Build | ||
uses: actions/upload-artifact@v3 | ||
if: matrix.os == 'ubuntu-latest' | ||
with: | ||
tag_name: ${{ steps.vars.outputs.tag_name }} | ||
delete_release: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
name: linux | ||
path: ./build/bin/bfsd | ||
|
||
- name: Publish the Release | ||
uses: softprops/action-gh-release@v1 | ||
if: ${{ steps.vars.outputs.should_release == 'true' }} | ||
- name: Upload MacOS Build | ||
uses: actions/upload-artifact@v3 | ||
if: matrix.os == 'macos-latest' | ||
with: | ||
tag_name: ${{ steps.vars.outputs.tag_name }} | ||
files: release/* | ||
prerelease: true | ||
name: macos | ||
path: ./build/bin/bfsd | ||
|
||
release: | ||
name: Release | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set Env | ||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
|
||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
|
||
# ============================== | ||
# Download artifacts | ||
# ============================== | ||
|
||
- name: Download Artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: linux | ||
path: ./linux | ||
|
||
- name: Download Artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: macos | ||
path: ./macos | ||
|
||
# Rename assets | ||
- run: | | ||
mv ./linux/bfsd ./linux/linux | ||
mv ./macos/bfsd ./macos/macos | ||
# ============================== | ||
# Create release | ||
# ============================== | ||
- name: Generate Change Log | ||
id: changelog | ||
run: | | ||
chmod 755 ./.github/generate_change_log.sh | ||
CHANGELOG=$(./.github/generate_change_log.sh ${{ env.RELEASE_VERSION }}) | ||
echo "CHANGELOG<<EOF" >> $GITHUB_ENV | ||
echo "$CHANGELOG" >> $GITHUB_ENV | ||
echo "EOF" >> $GITHUB_ENV | ||
- name: Create Release | ||
uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.GH_ACCESS_SECRET }} # This token is provided by Actions, you do not need to create your own token | ||
with: | ||
tag_name: ${{ env.RELEASE_VERSION}} | ||
release_name: ${{ env.RELEASE_VERSION}} | ||
body: | | ||
${{ env.CHANGELOG }} | ||
draft: false | ||
prerelease: false | ||
files: | | ||
./linux/linux | ||
./macos/macos |
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
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
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