Skip to content

Add bitcoin core v28.0 #78

Add bitcoin core v28.0

Add bitcoin core v28.0 #78

Workflow file for this run

name: build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
version:
- '27'
- '27/alpine'
- '26'
- '26/alpine'
- '25'
- '25/alpine'
- '24'
- '24/alpine'
- '23'
- '23/alpine'
fail-fast: false
steps:
- name: Set up Docker Buildx
uses: crazy-max/ghaction-docker-buildx@v1
- name: Checkout
uses: actions/checkout@v2
- name: Prepare Docker build
id: prepare
run: |
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
BITCOIN_VERSION=${{matrix.version}}
LATEST_BITCOIN_MAJOR_VERSION=$(find . -type d -maxdepth 1 -not -path '*/\.*' | sort -n | tail -n 1 | cut -c 3-)
PLATFORMS="linux/amd64"
PUSH=false
REPO=${{ github.repository_owner }}/bitcoin-core
TAGS=()
if [[ $GITHUB_REF == refs/tags/* ]]; then
TAG=${GITHUB_REF#refs/tags/}
PUSH=true
if [[ ${BITCOIN_VERSION} == *"alpine"* ]]; then
TAGS+=("$REPO:$TAG-alpine")
else
TAGS+=("$REPO:$TAG")
fi
if [ $(version ${TAG}) -ge $(version "22.0") ]; then
TAG_MAJOR_MINOR=$(echo $TAG | cut -c -2)"
else
TAG_MAJOR_MINOR=$(echo $TAG | cut -c -4)"
fi
if [ $(version ${TAG_MAJOR_MINOR}) -ne $(version ${BITCOIN_VERSION}) ]; then
echo "Skipping build of base image $BITCOIN_VERSION/ as ${TAG} is targeted at ${TAG_MAJOR_MINOR}/"
exit 0
fi
else
TAGS=("$REPO:${BITCOIN_VERSION/\//-}")
if [ $(version ${BITCOIN_VERSION}) -ge $(version ${LATEST_BITCOIN_MAJOR_VERSION}) ]; then
echo "Version $(version ${BITCOIN_VERSION}) is greater than or equal to $(version ${LATEST_BITCOIN_MAJOR_VERSION}), tagging as latest"
if [[ ${BITCOIN_VERSION} != *"alpine"* ]]; then
TAGS+=("$REPO:latest")
else
TAGS+=("$REPO:alpine")
fi
fi
if [ $GITHUB_REF == "refs/heads/master" ]; then
PUSH=true
fi
fi
if [[ ${BITCOIN_VERSION} != *"alpine"* ]] && [ $(version ${BITCOIN_VERSION}) -ge $(version "0.19") ]; then
PLATFORMS="linux/amd64,linux/arm/v7,linux/arm64"
fi
echo ::set-output name=build_date::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
echo ::set-output name=docker_platforms::${PLATFORMS}
echo ::set-output name=docker_username::${{ secrets.DOCKER_USERNAME }}
echo ::set-output name=push::${PUSH}
echo ::set-output name=tags::${TAGS[@]}
echo ::set-output name=build::true
- if: ${{ steps.prepare.outputs.build }} == 'true'
name: Login into Docker Hub
uses: lightninglabs/gh-actions/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_API_KEY }}
- if: ${{ steps.prepare.outputs.build }} == 'true'
name: Build Docker image
run: |
TAGS=(${{ steps.prepare.outputs.tags }})
echo "Build date: ${{ steps.prepare.outputs.build_date }}"
echo "Docker platform: ${{ steps.prepare.outputs.docker_platforms }}"
echo "Push: ${{ steps.prepare.outputs.push }}"
echo "Tags: ${{ steps.prepare.outputs.tags }}"
echo docker buildx build --platform ${{ steps.prepare.outputs.docker_platforms }} \
--output "type=image,push=${{steps.prepare.outputs.push}}" \
--progress=plain \
--build-arg "BUILD_DATE=${{ steps.prepare.outputs.build_date }}" \
--build-arg "VCS_REF=${GITHUB_SHA::8}" \
$(printf "%s" "${TAGS[@]/#/ --tag }" ) \
${{ matrix.version }}/
docker buildx build --platform ${{ steps.prepare.outputs.docker_platforms }} \
--output "type=image,push=${{steps.prepare.outputs.push}}" \
--progress=plain \
--build-arg "BUILD_DATE=${{ steps.prepare.outputs.build_date }}" \
--build-arg "VCS_REF=${GITHUB_SHA::8}" \
$(printf "%s" "${TAGS[@]/#/ --tag }" ) \
${{ matrix.version }}/
- if: ${{ steps.prepare.outputs.build }} == 'true'
name: Clear Docker credentials
run: |
rm -f ${HOME}/.docker/config.json