From d6b0ff7de784548faad40391816099890324557a Mon Sep 17 00:00:00 2001 From: lesterli Date: Sat, 19 Oct 2024 09:52:21 +0800 Subject: [PATCH] feat: add a CI workflow to publish the bitcoinsim image (#19) --- .github/workflows/publish.yml | 17 +++++++++++++++++ contrib/images/bitcoindsim/wrapper.sh | 10 +++------- 2 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..9ebedc35 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,17 @@ +name: docker_publish + +on: + push: + paths: + - 'contrib/images/bitcoindsim/**' + +jobs: + docker_pipeline: + needs: [] + uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@v0.7.0 + secrets: inherit + with: + publish: true + dockerfile: ./contrib/images/bitcoindsim/Dockerfile + dockerContext: ./contrib/images/bitcoindsim + repoName: bitcoindsim \ No newline at end of file diff --git a/contrib/images/bitcoindsim/wrapper.sh b/contrib/images/bitcoindsim/wrapper.sh index 75836921..0f0a9058 100755 --- a/contrib/images/bitcoindsim/wrapper.sh +++ b/contrib/images/bitcoindsim/wrapper.sh @@ -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 @@ -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 < "$BITCOIN_CONF" # Enable ${BITCOIN_NETWORK} mode. ${BITCOIN_NETWORK}=1 @@ -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"