Merge pull request #1322 from bnb-chain/develop #307
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* | |
jobs: | |
build: | |
name: Build Release | |
strategy: | |
matrix: | |
go-version: [1.20.x] | |
os: [ ubuntu-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 | |
~\AppData\Local\go-build | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- 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- | |
- uses: bufbuild/[email protected] | |
with: | |
version: 1.14.0 | |
buf_user: "${{ secrets.BUF_REGISTRY_USER }}" | |
buf_api_token: "${{ secrets.BUF_REGISTRY_SECRET }}" | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v1 | |
- run: | | |
make install-tools | |
make buf-gen | |
# ============================== | |
# Linux Build | |
# ============================== | |
- 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/gnfd-sp | |
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 | |
# Rename assets | |
- run: | | |
mv ./linux/gnfd-sp ./linux/linux | |
# ============================== | |
# 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 | |
with: | |
tag_name: ${{ env.RELEASE_VERSION}} | |
release_name: ${{ env.RELEASE_VERSION}} | |
body: | | |
${{ env.CHANGELOG }} | |
draft: false | |
prerelease: false | |
files: | | |
./linux/linux |