Skip to content

Commit

Permalink
hmmm
Browse files Browse the repository at this point in the history
  • Loading branch information
octobocto committed Oct 23, 2024
1 parent 8592f07 commit 509e0a0
Showing 1 changed file with 17 additions and 31 deletions.
48 changes: 17 additions & 31 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
- "master"
workflow_dispatch:

env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}

jobs:
build-linux:
name: Build Linux binaries
Expand Down Expand Up @@ -46,13 +49,7 @@ jobs:
- 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"
echo "BITCOIN_PATCHED_VERSION=${{ env.BRANCH_NAME }}-$BITCOIN_PATCHED_VERSION" >> "$GITHUB_ENV"
- uses: actions/upload-artifact@v4
with:
Expand All @@ -63,7 +60,6 @@ jobs:
build/src/bitcoin-cli
build/src/qt/bitcoin-qt
build-windows:
name: Build Windows binaries
runs-on: ubuntu-24.04
Expand Down Expand Up @@ -107,12 +103,6 @@ jobs:
- 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
Expand Down Expand Up @@ -162,13 +152,7 @@ jobs:
- 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"
echo "BITCOIN_PATCHED_VERSION=${{ env.BRANCH_NAME }}$BITCOIN_PATCHED_VERSION" >> "$GITHUB_ENV"
- uses: actions/upload-artifact@v4
with:
Expand All @@ -183,22 +167,24 @@ jobs:
name: Upload artifacts to releases.drivechain.info
runs-on: ubuntu-latest
needs: [build-linux, build-macos, build-windows]
if: github.repository_owner == 'LayerTwo-Labs'
if: >
(github.event_name == 'push' &&
github.repository_owner == 'LayerTwo-Labs' &&
github.head_ref == 'master') ||
github.head_ref == 'some-whitelisted-branch'
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"
if [ "${{ github.head_ref }}" == "master" ]; then
VERSION="latest"
else
ARTIFACT_PREFIX="L1-bitcoin-patched-latest"
VERSION="${{ github.ref_name }}"
fi
ARTIFACT_PREFIX="L1-bitcoin-patched-$VERSION"
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"
Expand All @@ -214,4 +200,4 @@ jobs:
pass: ${{ secrets.RELEASES_SERVER_PW }}
port: 22
scp: |
'L1-bitcoin-patched-*latest-*.zip' => '/var/www/html/'
'L1-bitcoin-patched-*.zip' => '/var/www/html/'

0 comments on commit 509e0a0

Please sign in to comment.