Merge pull request #1019 from bnb-chain/r_10_21 #30
Workflow file for this run
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
name: release | |
on: | |
push: | |
# Publish `v1.2.3` tags as releases. | |
tags: | |
- v* | |
env: | |
CGO_CFLAGS: "-O -D__BLST_PORTABLE__" | |
CGO_CFLAGS_ALLOW: "-O -D__BLST_PORTABLE__" | |
jobs: | |
build: | |
name: Build Release | |
strategy: | |
matrix: | |
go-version: [1.19.x] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- uses: actions/cache@v3 | |
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@v3 | |
if: matrix.os == 'ubuntu-latest' | |
with: | |
name: linux | |
path: ./build | |
- name: Upload MacOS Build | |
uses: actions/upload-artifact@v3 | |
if: matrix.os == 'macos-latest' | |
with: | |
name: macos | |
path: ./build | |
- name: Upload Windows Build | |
uses: actions/upload-artifact@v3 | |
if: matrix.os == 'windows-latest' | |
with: | |
name: windows | |
path: ./build | |
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 | |
- name: Download Artifacts | |
uses: actions/download-artifact@v3 | |
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: 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 }} # 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_binary.zip | |
./macos_binary.zip | |
./windows_binary.zip | |
./mainnet_config.zip | |
./testnet_config.zip |