Skip to content

Commit

Permalink
feat: add a CI workflow to publish the bitcoinsim image (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
lesterli authored Oct 19, 2024
1 parent da96793 commit d6b0ff7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: docker_publish

on:
push:
paths:
- 'contrib/images/bitcoindsim/**'

jobs:
docker_pipeline:
needs: []
uses: babylonlabs-io/.github/.github/workflows/[email protected]
secrets: inherit
with:
publish: true
dockerfile: ./contrib/images/bitcoindsim/Dockerfile
dockerContext: ./contrib/images/bitcoindsim
repoName: bitcoindsim
10 changes: 3 additions & 7 deletions contrib/images/bitcoindsim/wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if [[ -z "$BITCOIN_RPC_PORT" ]]; then
BITCOIN_RPC_PORT="18443"
fi

if [[ "$BITCOIN_NETWORK" != "regtest" && "$BITCOIN_NETWORK" != "signet" && "$BITCOIN_NETWORK" != "testnet" ]]; then
if [[ "$BITCOIN_NETWORK" != "regtest" && "$BITCOIN_NETWORK" != "signet" ]]; then
echo "Unsupported network: $BITCOIN_NETWORK"
exit 1
fi
Expand All @@ -22,11 +22,7 @@ if [[ ! -d "$BITCOIN_DATA" ]]; then
mkdir -p "$BITCOIN_DATA"
fi
echo "Generating bitcoin.conf file at $BITCOIN_CONF"
if [[ "$BITCOIN_NETWORK" == "testnet" ]]; then
NETWORK_LABEL="test"
else
NETWORK_LABEL="$BITCOIN_NETWORK"
fi
NETWORK_LABEL="$BITCOIN_NETWORK"
cat <<EOF > "$BITCOIN_CONF"
# Enable ${BITCOIN_NETWORK} mode.
${BITCOIN_NETWORK}=1
Expand Down Expand Up @@ -110,7 +106,7 @@ if [[ "$BITCOIN_NETWORK" == "regtest" ]]; then
fi
sleep "${GENERATE_INTERVAL_SECS}"
done
elif [[ "$BITCOIN_NETWORK" == "signet" || "$BITCOIN_NETWORK" == "testnet" ]]; then
elif [[ "$BITCOIN_NETWORK" == "signet" ]]; then
# Check if the wallet database already exists.
if [[ -d "$BITCOIN_DATA"/${BITCOIN_NETWORK}/wallets/"$BTCSTAKER_WALLET_NAME" ]]; then
echo "Wallet already exists, loading it: $BITCOIN_DATA/${BITCOIN_NETWORK}/wallets/$BTCSTAKER_WALLET_NAME"
Expand Down

0 comments on commit d6b0ff7

Please sign in to comment.