2022-07-05 11:14:21 +08:00
|
|
|
name: Release
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
# Publish `v1.2.3` tags as releases.
|
|
|
|
tags:
|
|
|
|
- v*
|
2023-05-05 16:48:43 +08:00
|
|
|
env:
|
|
|
|
CGO_CFLAGS: "-O -D__BLST_PORTABLE__"
|
|
|
|
CGO_CFLAGS_ALLOW: "-O -D__BLST_PORTABLE__"
|
2022-07-05 11:14:21 +08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: Build Release
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-01-02 14:44:39 +08:00
|
|
|
go-version: [1.21.x]
|
2022-12-22 16:47:43 +08:00
|
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
2022-07-05 11:14:21 +08:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout Code
|
2022-12-22 16:47:43 +08:00
|
|
|
uses: actions/checkout@v3
|
2022-07-05 11:14:21 +08:00
|
|
|
|
|
|
|
- name: Install Go
|
2022-12-22 16:47:43 +08:00
|
|
|
uses: actions/setup-go@v3
|
2022-07-05 11:14:21 +08:00
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go-version }}
|
|
|
|
|
2022-12-22 16:47:43 +08:00
|
|
|
- uses: actions/cache@v3
|
2022-07-05 11:14:21 +08:00
|
|
|
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
|
2022-12-22 16:47:43 +08:00
|
|
|
~\AppData\Local\go-build
|
2022-07-05 11:14:21 +08:00
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-
|
2022-12-22 16:47:43 +08:00
|
|
|
|
2022-07-05 11:14:21 +08:00
|
|
|
# ==============================
|
|
|
|
# Linux/Macos/Windows Build
|
|
|
|
# ==============================
|
|
|
|
|
|
|
|
- name: Build Binary for ${{matrix.os}}
|
2023-04-24 22:30:27 +08:00
|
|
|
if: matrix.os == 'ubuntu-latest'
|
|
|
|
run: |
|
|
|
|
go mod download
|
|
|
|
wget https://musl.cc/x86_64-linux-musl-cross.tgz
|
|
|
|
tar -xvf ./x86_64-linux-musl-cross.tgz
|
|
|
|
GIT_COMMIT=$(git rev-parse HEAD)
|
|
|
|
GIT_COMMIT_DATE=$(git log -n1 --pretty='format:%cd' --date=format:'%Y%m%d')
|
|
|
|
GOOS=linux GOARCH=amd64 CGO_ENABLED=1 CC=$(pwd)/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc go build -ldflags "-X main.gitCommit=$GIT_COMMIT -X main.gitDate=$GIT_COMMIT_DATE -extldflags=-static" -o ./build/bin/geth -a ./cmd/geth
|
|
|
|
|
|
|
|
- name: Build Binary for ${{matrix.os}}
|
|
|
|
if: matrix.os != 'ubuntu-latest'
|
2023-02-02 19:36:37 +08:00
|
|
|
run: |
|
|
|
|
go mod download
|
|
|
|
make geth
|
2022-07-05 11:14:21 +08:00
|
|
|
|
|
|
|
# ==============================
|
2022-09-26 17:31:16 +08:00
|
|
|
# Cross Compile for ARM
|
|
|
|
# ==============================
|
|
|
|
|
|
|
|
- name: Build Binary for ARM
|
2022-12-22 16:47:43 +08:00
|
|
|
if: matrix.os == 'ubuntu-latest'
|
2022-09-26 17:31:16 +08:00
|
|
|
run: |
|
2023-02-02 19:36:37 +08:00
|
|
|
go mod download
|
2023-04-24 22:30:27 +08:00
|
|
|
wget https://musl.cc/aarch64-linux-musl-cross.tgz
|
|
|
|
tar -xvf ./aarch64-linux-musl-cross.tgz
|
|
|
|
GIT_COMMIT=$(git rev-parse HEAD)
|
|
|
|
GIT_COMMIT_DATE=$(git log -n1 --pretty='format:%cd' --date=format:'%Y%m%d')
|
|
|
|
GOOS=linux GOARCH=arm64 CGO_ENABLED=1 CC=$(pwd)/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc go build -ldflags "-X main.gitCommit=$GIT_COMMIT -X main.gitDate=$GIT_COMMIT_DATE -extldflags=-static" -o ./build/bin/geth-linux-arm64 -a ./cmd/geth
|
|
|
|
|
2022-09-26 17:31:16 +08:00
|
|
|
# ==============================
|
2022-07-05 11:14:21 +08:00
|
|
|
# Upload artifacts
|
|
|
|
# ==============================
|
|
|
|
|
|
|
|
- name: Upload Linux Build
|
2024-10-08 04:49:41 -03:00
|
|
|
uses: actions/upload-artifact@v4.3.3
|
2022-12-22 16:47:43 +08:00
|
|
|
if: matrix.os == 'ubuntu-latest'
|
2022-07-05 11:14:21 +08:00
|
|
|
with:
|
|
|
|
name: linux
|
|
|
|
path: ./build/bin/geth
|
|
|
|
|
|
|
|
- name: Upload MacOS Build
|
2024-10-08 04:49:41 -03:00
|
|
|
uses: actions/upload-artifact@v4.3.3
|
2022-12-22 16:47:43 +08:00
|
|
|
if: matrix.os == 'macos-latest'
|
2022-07-05 11:14:21 +08:00
|
|
|
with:
|
|
|
|
name: macos
|
|
|
|
path: ./build/bin/geth
|
|
|
|
|
|
|
|
- name: Upload Windows Build
|
2024-10-08 04:49:41 -03:00
|
|
|
uses: actions/upload-artifact@v4.3.3
|
2022-12-22 16:47:43 +08:00
|
|
|
if: matrix.os == 'windows-latest'
|
2022-07-05 11:14:21 +08:00
|
|
|
with:
|
|
|
|
name: windows
|
|
|
|
path: ./build/bin/geth.exe
|
|
|
|
|
2022-09-26 17:31:16 +08:00
|
|
|
- name: Upload ARM-64 Build
|
2024-10-08 04:49:41 -03:00
|
|
|
uses: actions/upload-artifact@v4.3.3
|
2022-12-22 16:47:43 +08:00
|
|
|
if: matrix.os == 'ubuntu-latest'
|
2022-09-26 17:31:16 +08:00
|
|
|
with:
|
|
|
|
name: arm64
|
2022-11-28 22:38:59 +08:00
|
|
|
path: ./build/bin/geth-linux-arm64
|
2022-09-26 17:31:16 +08:00
|
|
|
|
2022-07-05 11:14:21 +08:00
|
|
|
release:
|
|
|
|
name: Release
|
|
|
|
needs: build
|
2022-12-22 16:47:43 +08:00
|
|
|
runs-on: ubuntu-latest
|
2022-07-05 11:14:21 +08:00
|
|
|
steps:
|
|
|
|
- name: Set Env
|
|
|
|
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Checkout Code
|
2022-12-22 16:47:43 +08:00
|
|
|
uses: actions/checkout@v3
|
2022-07-05 11:14:21 +08:00
|
|
|
|
|
|
|
# ==============================
|
|
|
|
# Download artifacts
|
|
|
|
# ==============================
|
|
|
|
|
|
|
|
- name: Download Artifacts
|
2024-09-04 16:12:07 +08:00
|
|
|
uses: actions/download-artifact@v4.1.7
|
2022-07-05 11:14:21 +08:00
|
|
|
with:
|
|
|
|
name: linux
|
|
|
|
path: ./linux
|
|
|
|
|
|
|
|
- name: Download Artifacts
|
2024-09-04 16:12:07 +08:00
|
|
|
uses: actions/download-artifact@v4.1.7
|
2022-07-05 11:14:21 +08:00
|
|
|
with:
|
|
|
|
name: macos
|
|
|
|
path: ./macos
|
|
|
|
|
|
|
|
- name: Download Artifacts
|
2024-09-04 16:12:07 +08:00
|
|
|
uses: actions/download-artifact@v4.1.7
|
2022-07-05 11:14:21 +08:00
|
|
|
with:
|
|
|
|
name: windows
|
|
|
|
path: ./windows
|
|
|
|
|
2022-09-26 17:31:16 +08:00
|
|
|
- name: Download Artifacts
|
2024-09-04 16:12:07 +08:00
|
|
|
uses: actions/download-artifact@v4.1.7
|
2022-09-26 17:31:16 +08:00
|
|
|
with:
|
|
|
|
name: arm64
|
|
|
|
path: ./arm64
|
|
|
|
|
2022-07-05 11:14:21 +08:00
|
|
|
- name: Download Config File
|
|
|
|
run: |
|
|
|
|
. ./.github/release.env
|
|
|
|
echo "mainnet.zip url: $MAINNET_FILE_URL"
|
|
|
|
echo "testnet.zip url: $TESTNET_FILE_URL"
|
|
|
|
curl -L $MAINNET_FILE_URL -o ./mainnet.zip
|
|
|
|
curl -L $TESTNET_FILE_URL -o ./testnet.zip
|
|
|
|
# ==============================
|
|
|
|
# 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
|
2022-12-22 16:47:43 +08:00
|
|
|
|
|
|
|
# Rename assets
|
|
|
|
- run: |
|
|
|
|
mv ./linux/geth ./linux/geth_linux
|
|
|
|
mv ./macos/geth ./macos/geth_macos
|
|
|
|
mv ./windows/geth.exe ./windows/geth_windows.exe
|
|
|
|
|
2022-07-05 11:14:21 +08:00
|
|
|
- name: Create Release
|
2022-12-22 16:47:43 +08:00
|
|
|
uses: softprops/action-gh-release@v1
|
2022-07-05 11:14:21 +08:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
|
|
|
|
with:
|
2022-12-22 16:47:43 +08:00
|
|
|
tag_name: ${{ env.RELEASE_VERSION}}
|
|
|
|
release_name: ${{ env.RELEASE_VERSION}}
|
2022-07-05 11:14:21 +08:00
|
|
|
body: |
|
|
|
|
${{ env.CHANGELOG }}
|
|
|
|
draft: false
|
|
|
|
prerelease: false
|
2022-12-22 16:47:43 +08:00
|
|
|
files: |
|
|
|
|
./mainnet.zip
|
|
|
|
./testnet.zip
|
|
|
|
./linux/geth_linux
|
|
|
|
./macos/geth_macos
|
|
|
|
./windows/geth_windows.exe
|
|
|
|
./arm64/geth-linux-arm64
|