Skip to content

Merge pull request #618 from unclezoro/erods #74

Merge pull request #618 from unclezoro/erods

Merge pull request #618 from unclezoro/erods #74

Workflow file for this run

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, macos-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-
# ==============================
# Linux/Macos 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/bin/gnfd
- name: Upload MacOS Build
uses: actions/upload-artifact@v3
if: matrix.os == 'macos-latest'
with:
name: macos
path: ./build/bin/gnfd
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
# Prepare assets
- run: |
mv ./linux/gnfd ./linux/linux
mv ./macos/gnfd ./macos/macos
cp -r ./asset/configs/testnet_config ./testnet_config
zip -r ./testnet_config.zip ./testnet_config
cp -r ./asset/configs/mainnet_config ./mainnet_config
zip -r ./mainnet_config.zip ./mainnet_config
# ==============================
# 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 }} # 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
./testnet_config.zip
./mainnet_config.zip