1+ name : Build and Release
2+
3+ on :
4+ pull_request :
5+ push :
6+ branches :
7+ - " master"
8+ workflow_dispatch :
9+
10+ jobs :
11+ build-linux :
12+ name : Build Linux binaries
13+ runs-on : ubuntu-24.04
14+ steps :
15+ - name : install Linux deps
16+ run : |
17+ sudo apt-get install build-essential cmake libboost-dev \
18+ libevent-dev pkg-config python3 qtbase5-dev qttools5-dev \
19+ qttools5-dev-tools qtwayland5
20+
21+ - uses : actions/checkout@v4
22+
23+ - name : Restore cached dependencies
24+ uses : actions/cache/restore@v4
25+ with :
26+ path : ./depends
27+ key : linux-${{ hashFiles('depends/packages/**') }}
28+
29+ - name : download dependencies
30+ run : make -C ./depends download-linux
31+
32+ - name : build dependencies
33+ run : make -C ./depends -j4
34+
35+ - name : Cache dependencies
36+ uses : actions/cache/save@v4
37+ with :
38+ path : ./depends
39+ key : linux-${{ hashFiles('depends/packages/**') }}
40+
41+ - name : build
42+ run : |
43+ cmake -B build --toolchain depends/x86_64-pc-linux-gnu/toolchain.cmake
44+ cmake --build build -j 4
45+
46+ - name : ' Set environment variables: version number'
47+ run : |
48+ BITCOIN_PATCHED_VERSION=$(grep -oP "(?<=^CMAKE_PROJECT_VERSION:STATIC=).+(?=)" build/CMakeCache.txt)
49+ BRANCH_NAME=${GITHUB_REF#refs/heads/}
50+ # Escape '/', '\' and space characters
51+ ESCAPED_BRANCH_NAME=$(echo "$BRANCH_NAME" | sed 's/[\/\\ ]/\\&/g')
52+ if [ "$ESCAPED_BRANCH_NAME" != "master" ]; then
53+ BITCOIN_PATCHED_VERSION="${ESCAPED_BRANCH_NAME}-${BITCOIN_PATCHED_VERSION}"
54+ fi
55+ echo "BITCOIN_PATCHED_VERSION=$BITCOIN_PATCHED_VERSION" >> "$GITHUB_ENV"
56+
57+ - uses : actions/upload-artifact@v4
58+ with :
59+ name : bitcoin-patched-${{ env.BITCOIN_PATCHED_VERSION }}-x86_64-unknown-linux-gnu
60+ if-no-files-found : error
61+ path : |
62+ build/src/bitcoind
63+ build/src/bitcoin-cli
64+ build/src/qt/bitcoin-qt
65+
66+
67+ build-windows :
68+ name : Build Windows binaries
69+ runs-on : ubuntu-24.04
70+ steps :
71+ # g++-mingw-w64-x86-64 is the cross-compiling toolchain needed for
72+ # producing Windows binaries
73+ - name : install deps
74+ run : |
75+ sudo apt install g++-mingw-w64-x86-64 build-essential cmake curl \
76+ libboost-dev libtool libevent-dev pkg-config curl git python3 \
77+ qtbase5-dev qttools5-dev qttools5-dev-tools
78+
79+ - name : configure the Windows toolchain
80+ run : sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
81+
82+ - uses : actions/checkout@v4
83+
84+ - name : Restore cached dependencies
85+ uses : actions/cache/restore@v4
86+ with :
87+ path : ./depends
88+ key : windows-${{ hashFiles('depends/packages/**') }}
89+
90+ - name : download dependencies
91+ run : make -C ./depends download-win
92+
93+ - name : build dependencies
94+ run : gmake -C ./depends HOST=x86_64-w64-mingw32 -j 4
95+
96+ - name : Cache dependencies
97+ uses : actions/cache/save@v4
98+ with :
99+ path : ./depends
100+ key : windows-${{ hashFiles('depends/packages/**') }}
101+
102+ - name : build
103+ run : |
104+ cmake -B build --toolchain depends/x86_64-w64-mingw32/toolchain.cmake
105+ cmake --build build -j 4
106+
107+ - name : ' Set environment variables: version number'
108+ run : |
109+ BITCOIN_PATCHED_VERSION=$(grep -oP "(?<=^CMAKE_PROJECT_VERSION:STATIC=).+(?=)" build/CMakeCache.txt)
110+ BRANCH_NAME=${GITHUB_REF#refs/heads/}
111+ # Escape '/', '\' and space characters
112+ ESCAPED_BRANCH_NAME=$(echo "$BRANCH_NAME" | sed 's/[\/\\ ]/\\&/g')
113+ if [ "$ESCAPED_BRANCH_NAME" != "master" ]; then
114+ BITCOIN_PATCHED_VERSION="${ESCAPED_BRANCH_NAME}-${BITCOIN_PATCHED_VERSION}"
115+ fi
116+ echo "BITCOIN_PATCHED_VERSION=$BITCOIN_PATCHED_VERSION" >> "$GITHUB_ENV"
117+
118+ - uses : actions/upload-artifact@v4
119+ with :
120+ name : bitcoin-patched-${{ env.BITCOIN_PATCHED_VERSION }}-x86_64-w64-mingw32
121+ if-no-files-found : error
122+ path : |
123+ build/src/bitcoind.exe
124+ build/src/bitcoin-cli.exe
125+ build/src/qt/bitcoin-qt.exe
126+
127+ build-macos :
128+ name : Build macOS binaries
129+ runs-on : macos-13
130+ steps :
131+ - uses : actions/checkout@v3
132+
133+ - name : install deps
134+ run : |
135+ # GNU grep is required, as BSD grep does not support perl regexes
136+ brew install boost cmake grep libevent pkg-config qrencode qt@5
137+
138+ - name : Restore cached dependencies
139+ uses : actions/cache/restore@v4
140+ with :
141+ path : ./depends
142+ key : macos-${{ hashFiles('depends/packages/**') }}
143+
144+ - name : download dependencies
145+ run : make -C ./depends download-osx
146+
147+ - name : build dependencies
148+ run : make -C ./depends -j 4
149+
150+ - name : Cache dependencies
151+ uses : actions/cache/save@v4
152+ with :
153+ path : ./depends
154+ key : macos-${{ hashFiles('depends/packages/**') }}
155+
156+ - name : build
157+ run : |
158+ ls depends
159+ cmake -B build -DBUILD_GUI=ON --toolchain depends/x86_64-apple-darwin*/toolchain.cmake
160+ cmake --build build -j 4
161+
162+ - name : ' Set environment variables: version number'
163+ run : |
164+ BITCOIN_PATCHED_VERSION=$(ggrep -oP "(?<=^CMAKE_PROJECT_VERSION:STATIC=).+(?=)" build/CMakeCache.txt)
165+ BRANCH_NAME=${GITHUB_REF#refs/heads/}
166+ # Escape '/', '\' and space characters
167+ ESCAPED_BRANCH_NAME=$(echo "$BRANCH_NAME" | sed 's/[\/\\ ]/\\&/g')
168+ if [ "$ESCAPED_BRANCH_NAME" != "master" ]; then
169+ BITCOIN_PATCHED_VERSION="${ESCAPED_BRANCH_NAME}-${BITCOIN_PATCHED_VERSION}"
170+ fi
171+ echo "BITCOIN_PATCHED_VERSION=$BITCOIN_PATCHED_VERSION" >> "$GITHUB_ENV"
172+
173+ - uses : actions/upload-artifact@v4
174+ with :
175+ name : bitcoin-patched-${{ env.BITCOIN_PATCHED_VERSION }}-x86_64-apple-darwin
176+ if-no-files-found : error
177+ path : |
178+ build/src/bitcoind
179+ build/src/bitcoin-cli
180+ build/src/qt/bitcoin-qt
181+
182+ upload-artifacts-to-releases-drivechain-info :
183+ name : Upload artifacts to releases.drivechain.info
184+ runs-on : ubuntu-latest
185+ needs : [build-linux, build-macos, build-windows]
186+ if : github.repository_owner == 'LayerTwo-Labs'
187+ steps :
188+ - name : Download artifacts
189+ uses : actions/download-artifact@v4
190+
191+ - name : Zip artifacts
192+ run : |
193+ ARTIFACT_PREFIX=''
194+ BRANCH_NAME=${GITHUB_REF#refs/heads/}
195+ # Escape '/', '\' and space characters
196+ ESCAPED_BRANCH_NAME=$(echo "$BRANCH_NAME" | sed 's/[\/\\ ]/\\&/g')
197+ if [ "$ESCAPED_BRANCH_NAME" != "master" ]; then
198+ ARTIFACT_PREFIX="L1-bitcoin-patched-${ESCAPED_BRANCH_NAME}-latest"
199+ else
200+ ARTIFACT_PREFIX="L1-bitcoin-patched-latest"
201+ fi
202+ mv bitcoin-patched-*-x86_64-apple-darwin "${ARTIFACT_PREFIX}-x86_64-apple-darwin"
203+ zip -r "${ARTIFACT_PREFIX}-x86_64-apple-darwin.zip" "${ARTIFACT_PREFIX}-x86_64-apple-darwin"
204+ mv bitcoin-patched-*-x86_64-w64-mingw32 "${ARTIFACT_PREFIX}-x86_64-w64-mingw32"
205+ zip -r "${ARTIFACT_PREFIX}-x86_64-w64-mingw32.zip" "${ARTIFACT_PREFIX}-x86_64-w64-mingw32"
206+ mv bitcoin-patched-*-x86_64-unknown-linux-gnu "${ARTIFACT_PREFIX}-x86_64-unknown-linux-gnu"
207+ zip -r "${ARTIFACT_PREFIX}-x86_64-unknown-linux-gnu.zip" "${ARTIFACT_PREFIX}-x86_64-unknown-linux-gnu"
208+
209+ - name : Upload artifacts to releases.drivechain.info
210+ uses : cross-the-world/ssh-scp-ssh-pipelines@latest
211+ with :
212+ host : 45.33.96.47
213+ user : root
214+ pass : ${{ secrets.RELEASES_SERVER_PW }}
215+ port : 22
216+ scp : |
217+ 'L1-bitcoin-patched-*latest-*.zip' => '/var/www/html/'
0 commit comments