-
Notifications
You must be signed in to change notification settings - Fork 14
132 lines (109 loc) · 3.91 KB
/
release.yml
File metadata and controls
132 lines (109 loc) · 3.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Release Binaries
on:
push:
tags:
- v[0-9]+.*
workflow_dispatch:
permissions:
contents: write
packages: read
env:
CARGO_TERM_COLOR: always
jobs:
build-and-release:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Xcode Command Line Tools
if: matrix.os == 'macos-latest'
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Fix macOS SDK for cgo
if: runner.os == 'macOS'
run: |
SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
echo "SDKROOT=$SDKROOT" >> $GITHUB_ENV
echo "CGO_ENABLED=1" >> $GITHUB_ENV
- name: Install Ziren toolchain
run: |
curl --proto '=https' --tlsv1.2 -sSf \
https://raw.githubusercontent.com/ProjectZKM/toolchain/refs/heads/main/setup.sh | sh
# Install Go for all platforms (required for zkm-recursion-gnark-ffi)
- name: Install Go (Ubuntu, macOS)
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: brew install protobuf
- name: Extract version from tag
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/}
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Version: $VERSION"
- name: Build all binaries in release mode
run: |
source ~/.zkm-toolchain/env && cd node && cargo build -r
- name: Create release artifacts directory
run: mkdir -p release-artifacts
- name: Collect binaries
run: |
BINS=(
"target/release/bitvm2-noded"
"target/release/sequencer-set-publish"
"target/release/challenge"
"target/release/send-rbf"
"target/release/pegin-request"
"target/release/pegout"
"target/release/update-db"
)
if [ "${{ runner.os }}" = "Linux" ]; then
PLATFORM="x86_64-linux"
CHECKSUM_CMD="sha256sum"
elif [ "${{ runner.arch }}" = "ARM64" ]; then
PLATFORM="aarch64-macos"
CHECKSUM_CMD="shasum -a 256"
else
PLATFORM="x86_64-macos"
CHECKSUM_CMD="shasum -a 256"
fi
STAGING_DIR="release-staging"
mkdir -p "$STAGING_DIR"
for bin in "${BINS[@]}"; do
if [ -f "$bin" ]; then
BASENAME=$(basename "$bin")
cp "$bin" "$STAGING_DIR/"
chmod +x "$STAGING_DIR/$BASENAME"
echo "✓ $BASENAME"
fi
done
ARCHIVE_NAME="bitvm2-node-${VERSION}-${PLATFORM}.tar.gz"
tar -czf "release-artifacts/${ARCHIVE_NAME}" -C "$STAGING_DIR" .
$CHECKSUM_CMD "release-artifacts/${ARCHIVE_NAME}" > "release-artifacts/${ARCHIVE_NAME}.sha256"
echo "Archive created:"
ls -lh release-artifacts/
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: release-artifacts/*
draft: false
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload to Releases summary
run: |
echo "## Released Binaries (${{ runner.os }})" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Version: $VERSION" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Archive:" >> $GITHUB_STEP_SUMMARY
ls -1 release-artifacts/ | sed 's/^/- /' >> $GITHUB_STEP_SUMMARY