Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: dont upload PRs to releases.drivechain.info #5

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 13 additions & 29 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,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 All @@ -63,7 +57,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 +100,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,12 +149,6 @@ 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"

- uses: actions/upload-artifact@v4
Expand All @@ -183,22 +164,25 @@ 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.ref == 'refs/heads/master') ||
github.ref == 'refs/heads/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.ref }}" == "refs/heads/master" ]; then
VERSION="latest"
else
ARTIFACT_PREFIX="L1-bitcoin-patched-latest"
# We're on a PR, use the branch name
VERSION="${{ github.head_ref }}"
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 +198,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/'
Loading