upload builds to releases.drivechain.info #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Release | |
on: | |
pull_request: | |
push: | |
branches: | |
- "master" | |
workflow_dispatch: | |
jobs: | |
build-linux: | |
name: Build Linux binaries | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: install Linux deps | |
run: | | |
sudo apt-get install build-essential cmake libboost-dev \ | |
libevent-dev pkg-config python3 qtbase5-dev qttools5-dev \ | |
qttools5-dev-tools qtwayland5 | |
- uses: actions/checkout@v4 | |
- name: Restore cached dependencies | |
uses: actions/cache/restore@v4 | |
with: | |
path: ./depends | |
key: linux-${{ hashFiles('depends/packages/**') }} | |
- name: download dependencies | |
run: make -C ./depends download-linux | |
- name: build dependencies | |
run: make -C ./depends -j4 | |
- name: Cache dependencies | |
uses: actions/cache/save@v4 | |
with: | |
path: ./depends | |
key: linux-${{ hashFiles('depends/packages/**') }} | |
- name: build | |
run: | | |
cmake -B build --toolchain depends/x86_64-pc-linux-gnu/toolchain.cmake | |
cmake --build build -j 4 | |
- name: 'Set environment variables: version number' | |
run: | | |
BITCOIN_PATCHED_VERSION=$(grep -oP "(?<=^CMAKE_PROJECT_VERSION:STATIC=).+(?=)" build/CMakeCache.txt) | |
BRANCH_NAME=${GITHUB_REF#refs/heads/} | |
# Escape '/', '\' and space characters | |
ESCAPED_BRANCH_NAME=$(echo "$BRANCH_NAME" | sed 's/[\/\\ ]/\\&/g') | |
if [ "$ESCAPED_BRANCH_NAME" != "master" ]; then | |
BITCOIN_PATCHED_VERSION="${ESCAPED_BRANCH_NAME}-${BITCOIN_PATCHED_VERSION}" | |
fi | |
echo "BITCOIN_PATCHED_VERSION=$BITCOIN_PATCHED_VERSION" >> "$GITHUB_ENV" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: bitcoin-patched-${{ env.BITCOIN_PATCHED_VERSION }}-x86_64-unknown-linux-gnu | |
if-no-files-found: error | |
path: | | |
build/src/bitcoind | |
build/src/bitcoin-cli | |
build/src/qt/bitcoin-qt | |
build-windows: | |
name: Build Windows binaries | |
runs-on: ubuntu-24.04 | |
steps: | |
# g++-mingw-w64-x86-64 is the cross-compiling toolchain needed for | |
# producing Windows binaries | |
- name: install deps | |
run: | | |
sudo apt install g++-mingw-w64-x86-64 build-essential cmake curl \ | |
libboost-dev libtool libevent-dev pkg-config curl git python3 \ | |
qtbase5-dev qttools5-dev qttools5-dev-tools | |
- name: configure the Windows toolchain | |
run: sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix | |
- uses: actions/checkout@v4 | |
- name: Restore cached dependencies | |
uses: actions/cache/restore@v4 | |
with: | |
path: ./depends | |
key: windows-${{ hashFiles('depends/packages/**') }} | |
- name: download dependencies | |
run: make -C ./depends download-win | |
- name: build dependencies | |
run: gmake -C ./depends HOST=x86_64-w64-mingw32 -j 4 | |
- name: Cache dependencies | |
uses: actions/cache/save@v4 | |
with: | |
path: ./depends | |
key: windows-${{ hashFiles('depends/packages/**') }} | |
- name: build | |
run: | | |
cmake -B build --toolchain depends/x86_64-w64-mingw32/toolchain.cmake | |
cmake --build build -j 4 | |
- name: 'Set environment variables: version number' | |
run: | | |
BITCOIN_PATCHED_VERSION=$(grep -oP "(?<=^CMAKE_PROJECT_VERSION:STATIC=).+(?=)" build/CMakeCache.txt) | |
BRANCH_NAME=${GITHUB_REF#refs/heads/} | |
# Escape '/', '\' and space characters | |
ESCAPED_BRANCH_NAME=$(echo "$BRANCH_NAME" | sed 's/[\/\\ ]/\\&/g') | |
if [ "$ESCAPED_BRANCH_NAME" != "master" ]; then | |
BITCOIN_PATCHED_VERSION="${ESCAPED_BRANCH_NAME}-${BITCOIN_PATCHED_VERSION}" | |
fi | |
echo "BITCOIN_PATCHED_VERSION=$BITCOIN_PATCHED_VERSION" >> "$GITHUB_ENV" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: bitcoin-patched-${{ env.BITCOIN_PATCHED_VERSION }}-x86_64-w64-mingw32 | |
if-no-files-found: error | |
path: | | |
build/src/bitcoind.exe | |
build/src/bitcoin-cli.exe | |
build/src/qt/bitcoin-qt.exe | |
build-macos: | |
name: Build macOS binaries | |
runs-on: macos-13 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: install deps | |
run: | | |
# GNU grep is required, as BSD grep does not support perl regexes | |
brew install boost cmake grep libevent pkg-config qrencode qt@5 | |
- name: Restore cached dependencies | |
uses: actions/cache/restore@v4 | |
with: | |
path: ./depends | |
key: macos-${{ hashFiles('depends/packages/**') }} | |
- name: download dependencies | |
run: make -C ./depends download-osx | |
- name: build dependencies | |
run: make -C ./depends -j 4 | |
- name: Cache dependencies | |
uses: actions/cache/save@v4 | |
with: | |
path: ./depends | |
key: macos-${{ hashFiles('depends/packages/**') }} | |
- name: build | |
run: | | |
ls depends | |
cmake -B build -DBUILD_GUI=ON --toolchain depends/x86_64-apple-darwin*/toolchain.cmake | |
cmake --build build -j 4 | |
- name: 'Set environment variables: version number' | |
run: | | |
BITCOIN_PATCHED_VERSION=$(ggrep -oP "(?<=^CMAKE_PROJECT_VERSION:STATIC=).+(?=)" build/CMakeCache.txt) | |
BRANCH_NAME=${GITHUB_REF#refs/heads/} | |
# Escape '/', '\' and space characters | |
ESCAPED_BRANCH_NAME=$(echo "$BRANCH_NAME" | sed 's/[\/\\ ]/\\&/g') | |
if [ "$ESCAPED_BRANCH_NAME" != "master" ]; then | |
BITCOIN_PATCHED_VERSION="${ESCAPED_BRANCH_NAME}-${BITCOIN_PATCHED_VERSION}" | |
fi | |
echo "BITCOIN_PATCHED_VERSION=$BITCOIN_PATCHED_VERSION" >> "$GITHUB_ENV" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: bitcoin-patched-${{ env.BITCOIN_PATCHED_VERSION }}-x86_64-apple-darwin | |
if-no-files-found: error | |
path: | | |
build/src/bitcoind | |
build/src/bitcoin-cli | |
build/src/qt/bitcoin-qt | |
upload-artifacts-to-releases-drivechain-info: | |
name: Upload artifacts to releases.drivechain.info | |
runs-on: ubuntu-latest | |
needs: [build-linux, build-macos, build-windows] | |
if: github.repository_owner == 'LayerTwo-Labs' | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
- name: Zip artifacts | |
run: | | |
ARTIFACT_PREFIX='' | |
BRANCH_NAME=${GITHUB_REF#refs/heads/} | |
# Escape '/', '\' and space characters | |
ESCAPED_BRANCH_NAME=$(echo "$BRANCH_NAME" | sed 's/[\/\\ ]/\\&/g') | |
if [ "$ESCAPED_BRANCH_NAME" != "master" ]; then | |
ARTIFACT_PREFIX="L1-bitcoin-patched-${ESCAPED_BRANCH_NAME}-latest" | |
else | |
ARTIFACT_PREFIX="L1-bitcoin-patched-latest" | |
fi | |
mv bitcoin-patched-*-x86_64-apple-darwin "${ARTIFACT_PREFIX}-x86_64-apple-darwin" | |
zip -r "${ARTIFACT_PREFIX}-x86_64-apple-darwin.zip" "${ARTIFACT_PREFIX}-x86_64-apple-darwin" | |
mv bitcoin-patched-*-x86_64-w64-mingw32 "${ARTIFACT_PREFIX}-x86_64-w64-mingw32" | |
zip -r "${ARTIFACT_PREFIX}-x86_64-w64-mingw32.zip" "${ARTIFACT_PREFIX}-x86_64-w64-mingw32" | |
mv bitcoin-patched-*-x86_64-unknown-linux-gnu "${ARTIFACT_PREFIX}-x86_64-unknown-linux-gnu" | |
zip -r "${ARTIFACT_PREFIX}-x86_64-unknown-linux-gnu.zip" "${ARTIFACT_PREFIX}-x86_64-unknown-linux-gnu" | |
- name: Upload artifacts to releases.drivechain.info | |
uses: cross-the-world/ssh-scp-ssh-pipelines@latest | |
with: | |
host: 45.33.96.47 | |
user: root | |
pass: ${{ secrets.RELEASES_SERVER_PW }} | |
port: 22 | |
scp: | | |
'L1-bitcoin-patched-*latest-*.zip' => '/var/www/html/' |