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
+ echo "BITCOIN_PATCHED_VERSION=$BITCOIN_PATCHED_VERSION" >> "$GITHUB_ENV"
50
+
51
+ - uses : actions/upload-artifact@v4
52
+ with :
53
+ name : bitcoin-patched-${{ env.BITCOIN_PATCHED_VERSION }}-x86_64-unknown-linux-gnu
54
+ if-no-files-found : error
55
+ path : |
56
+ build/src/bitcoind
57
+ build/src/bitcoin-cli
58
+ build/src/qt/bitcoin-qt
59
+
60
+ build-windows :
61
+ name : Build Windows binaries
62
+ runs-on : ubuntu-24.04
63
+ steps :
64
+ # g++-mingw-w64-x86-64 is the cross-compiling toolchain needed for
65
+ # producing Windows binaries
66
+ - name : install deps
67
+ run : |
68
+ sudo apt install g++-mingw-w64-x86-64 build-essential cmake curl \
69
+ libboost-dev libtool libevent-dev pkg-config curl git python3 \
70
+ qtbase5-dev qttools5-dev qttools5-dev-tools
71
+
72
+ - name : configure the Windows toolchain
73
+ run : sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
74
+
75
+ - uses : actions/checkout@v4
76
+
77
+ - name : Restore cached dependencies
78
+ uses : actions/cache/restore@v4
79
+ with :
80
+ path : ./depends
81
+ key : windows-${{ hashFiles('depends/packages/**') }}
82
+
83
+ - name : download dependencies
84
+ run : make -C ./depends download-win
85
+
86
+ - name : build dependencies
87
+ run : gmake -C ./depends HOST=x86_64-w64-mingw32 -j 4
88
+
89
+ - name : Cache dependencies
90
+ uses : actions/cache/save@v4
91
+ with :
92
+ path : ./depends
93
+ key : windows-${{ hashFiles('depends/packages/**') }}
94
+
95
+ - name : build
96
+ run : |
97
+ cmake -B build --toolchain depends/x86_64-w64-mingw32/toolchain.cmake
98
+ cmake --build build -j 4
99
+
100
+ - name : ' Set environment variables: version number'
101
+ run : |
102
+ BITCOIN_PATCHED_VERSION=$(grep -oP "(?<=^CMAKE_PROJECT_VERSION:STATIC=).+(?=)" build/CMakeCache.txt)
103
+ echo "BITCOIN_PATCHED_VERSION=$BITCOIN_PATCHED_VERSION" >> "$GITHUB_ENV"
104
+
105
+ - uses : actions/upload-artifact@v4
106
+ with :
107
+ name : bitcoin-patched-${{ env.BITCOIN_PATCHED_VERSION }}-x86_64-w64-mingw32
108
+ if-no-files-found : error
109
+ path : |
110
+ build/src/bitcoind.exe
111
+ build/src/bitcoin-cli.exe
112
+ build/src/qt/bitcoin-qt.exe
113
+
114
+ build-macos :
115
+ name : Build macOS binaries
116
+ runs-on : macos-13
117
+ steps :
118
+ - uses : actions/checkout@v3
119
+
120
+ - name : install deps
121
+ run : |
122
+ # GNU grep is required, as BSD grep does not support perl regexes
123
+ brew install boost cmake grep libevent pkg-config qrencode qt@5
124
+
125
+ - name : Restore cached dependencies
126
+ uses : actions/cache/restore@v4
127
+ with :
128
+ path : ./depends
129
+ key : macos-${{ hashFiles('depends/packages/**') }}
130
+
131
+ - name : download dependencies
132
+ run : make -C ./depends download-osx
133
+
134
+ - name : build dependencies
135
+ run : make -C ./depends -j 4
136
+
137
+ - name : Cache dependencies
138
+ uses : actions/cache/save@v4
139
+ with :
140
+ path : ./depends
141
+ key : macos-${{ hashFiles('depends/packages/**') }}
142
+
143
+ - name : build
144
+ run : |
145
+ ls depends
146
+ cmake -B build -DBUILD_GUI=ON --toolchain depends/x86_64-apple-darwin*/toolchain.cmake
147
+ cmake --build build -j 4
148
+
149
+ - name : ' Set environment variables: version number'
150
+ run : |
151
+ BITCOIN_PATCHED_VERSION=$(ggrep -oP "(?<=^CMAKE_PROJECT_VERSION:STATIC=).+(?=)" build/CMakeCache.txt)
152
+ echo "BITCOIN_PATCHED_VERSION=$BITCOIN_PATCHED_VERSION" >> "$GITHUB_ENV"
153
+
154
+ - uses : actions/upload-artifact@v4
155
+ with :
156
+ name : bitcoin-patched-${{ env.BITCOIN_PATCHED_VERSION }}-x86_64-apple-darwin
157
+ if-no-files-found : error
158
+ path : |
159
+ build/src/bitcoind
160
+ build/src/bitcoin-cli
161
+ build/src/qt/bitcoin-qt
162
+
163
+ upload-artifacts-to-releases-drivechain-info :
164
+ name : Upload artifacts to releases.drivechain.info
165
+ runs-on : ubuntu-latest
166
+ needs : [build-linux, build-macos, build-windows]
167
+ if : >
168
+ (github.event_name == 'push' &&
169
+ github.repository_owner == 'LayerTwo-Labs' &&
170
+ github.ref == 'refs/heads/master') ||
171
+ github.ref == 'refs/heads/some-whitelisted-branch'
172
+ steps :
173
+ - name : Download artifacts
174
+ uses : actions/download-artifact@v4
175
+ - name : Zip artifacts
176
+ run : |
177
+ if [ "${{ github.ref }}" == "refs/heads/master" ]; then
178
+ VERSION="latest"
179
+ else
180
+ # We're on a PR, use the branch name
181
+ VERSION="${{ github.head_ref }}"
182
+ fi
183
+
184
+ ARTIFACT_PREFIX="L1-bitcoin-patched-$VERSION"
185
+
186
+ mv bitcoin-patched-*-x86_64-apple-darwin "${ARTIFACT_PREFIX}-x86_64-apple-darwin"
187
+ zip -r "${ARTIFACT_PREFIX}-x86_64-apple-darwin.zip" "${ARTIFACT_PREFIX}-x86_64-apple-darwin"
188
+ mv bitcoin-patched-*-x86_64-w64-mingw32 "${ARTIFACT_PREFIX}-x86_64-w64-mingw32"
189
+ zip -r "${ARTIFACT_PREFIX}-x86_64-w64-mingw32.zip" "${ARTIFACT_PREFIX}-x86_64-w64-mingw32"
190
+ mv bitcoin-patched-*-x86_64-unknown-linux-gnu "${ARTIFACT_PREFIX}-x86_64-unknown-linux-gnu"
191
+ zip -r "${ARTIFACT_PREFIX}-x86_64-unknown-linux-gnu.zip" "${ARTIFACT_PREFIX}-x86_64-unknown-linux-gnu"
192
+
193
+ - name : Upload artifacts to releases.drivechain.info
194
+ uses : cross-the-world/ssh-scp-ssh-pipelines@latest
195
+ with :
196
+ host : 45.33.96.47
197
+ user : root
198
+ pass : ${{ secrets.RELEASES_SERVER_PW }}
199
+ port : 22
200
+ scp : |
201
+ 'L1-bitcoin-patched-*.zip' => '/var/www/html/'
0 commit comments