diff --git a/Makefile b/Makefile index 5ca431c9..431e1c75 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,8 @@ LINT = $(LINT_BIN) run -v --build-tags itest PKG := github.com/lightninglabs/lightning-node-connect MOBILE_PKG := $(PKG)/mobile -MOBILE_BUILD_DIR :=${GOPATH}/src/$(PKG)/build +MKFILE_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +MOBILE_BUILD_DIR := $(MKFILE_DIR)/build IOS_BUILD_DIR := $(MOBILE_BUILD_DIR)/ios IOS_BUILD := $(IOS_BUILD_DIR)/Lncmobile.xcframework ANDROID_BUILD_DIR := $(MOBILE_BUILD_DIR)/android @@ -76,13 +77,18 @@ wasm: cd cmd/wasm-client; CGO_ENABLED=0 GOOS=js GOARCH=wasm go build -trimpath -ldflags="$(LDFLAGS)" -tags="$(RPC_TAGS)" -v -o wasm-client.wasm . $(CP) cmd/wasm-client/wasm-client.wasm example/wasm-client.wasm +clean: + @$(call print, "Cleaning up.") + $(RM) -r $(MOBILE_BUILD_DIR) + $(RM) -r ./reproducible-builds/ + apple: - @$(call print, "Building iOS and macOS cxframework ($(IOS_BUILD)).") + @$(call print, "Building iOS and macOS xcframework ($(IOS_BUILD)).") mkdir -p $(IOS_BUILD_DIR) cd mobile; $(GOMOBILE_BIN) bind -target=ios,iossimulator,macos -tags="mobile $(DEV_TAGS) $(RPC_TAGS)" $(LDFLAGS_MOBILE) -v -o $(IOS_BUILD) $(MOBILE_PKG) ios: - @$(call print, "Building iOS cxframework ($(IOS_BUILD)).") + @$(call print, "Building iOS xcframework ($(IOS_BUILD)).") mkdir -p $(IOS_BUILD_DIR) cd mobile; $(GOMOBILE_BIN) bind -target=ios,iossimulator -tags="mobile $(DEV_TAGS) $(RPC_TAGS)" $(LDFLAGS_MOBILE) -v -o $(IOS_BUILD) $(MOBILE_PKG) # modify library files for import without C++ modules @@ -92,7 +98,7 @@ ios: sed -i.bak -E "s|$(IOS_STRING1)|$(IOS_STRING2)|g" $(IOS_FILE4) macos: - @$(call print, "Building macOS cxframework ($(IOS_BUILD)).") + @$(call print, "Building macOS xcframework ($(IOS_BUILD)).") mkdir -p $(IOS_BUILD_DIR) cd mobile; $(GOMOBILE_BIN) bind -target=macos -tags="mobile $(DEV_TAGS) $(RPC_TAGS)" $(LDFLAGS_MOBILE) -v -o $(IOS_BUILD) $(MOBILE_PKG) @@ -120,6 +126,10 @@ repro-wasm: #Remove the repro-wasm-image docker image rm repro-wasm-image +release: clean mobile repro-wasm + @$(call print, "Building release binaries for $(tag).") + ./scripts/release.sh $(tag) + # ======= # TESTING # ======= diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 00000000..6d906589 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,66 @@ +# LNC Release Process + +This document describes the steps needed to release a new version of LNC binaries. + +### System Requirements + +1. Android Studio with Android SDK (API level 16 or newer) +2. Xcode (latest version) +3. Go v1.19.8 or newer + +### Build Release Binaries + +From the root of the project, run the following command. Replace `vX.Y.Z-alpha` +with the next version number (ex: v0.2.0-alpha) + +```sh +$ make release tag=vX.Y.Z-alpha +``` + +When this completes, a `build` dir will be created with four files: + +- **lnc-vX.Y.Z-alpha.wasm**: the WASM reproducible binary +- **lnc-vX.Y.Z-alpha-android.zip**: the gomobile library for android +- **lnc-vX.Y.Z-alpha-ios.zip**: the gomobile library for iOS +- **manifest-vX.Y.Z-alpha.txt**: the sha256 hash manifest file + +### Sign the manifest and rename the signature file + +#### Sign the manifest file using your PGP key. + +- Replace `{PGP_EMAIL}` with your email address associated with your PGP key +- Replace `{GITHUB_USERNAME}` with your github username + +```sh +$ gpg --default-key {PGP_EMAIL} --output manifest-{GITHUB_USERNAME}-vX.Y.Z-alpha.sig --detach-sign manifest-vX.Y.Z-alpha.txt +``` + +### Create a tag and push to Github + +Using the `-s` option signs the tag with your PGP key + +```sh +$ git tag -s vX.Y.Z-alpha -m "lightning-node-connect vX.Y.Z-alpha" +$ git push origin vX.Y.Z-alpha +``` + +### Create Github Release + +On Github create a new release. Select the tag you just pushed, then click the +"Auto-generate release notes" button. + +Take the rest of the content from a previous release. Be sure to update the +version number and update the verification examples to use your own PGP key. + +In the assets, include these five files: + +- lnc-vX.Y.Z-alpha.wasm +- lnc-vX.Y.Z-alpha-android.zip +- lnc-vX.Y.Z-alpha-ios.zip +- manifest-vX.Y.Z-alpha.txt +- manifest-{GITHUB_USERNAME}-vX.Y.Z-alpha.sig + +### Deploy the WASM binary to CDN + +The `lnc-vX.Y.Z-alpha.wasm` should be deployed to our CDN so it is available +at the url `https://lightning.engineering/lnc-vX.Y.Z-alpha.wasm`. diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100755 index 00000000..dc0e4495 --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +set -e + +DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)" +BUILD_DIR=${DIR}/../build +TAG=${1} + +if [ -z "${TAG}" ]; then + echo "usage: $0 " + echo "Example: $0 v0.1.0-alpha" + exit 1 +fi + +pushd ${BUILD_DIR} + +# Copy the WASM binary +cp ../reproducible-builds/wasm-client.wasm lnc-${TAG}.wasm +rm -rf ../reproducible-builds/ + +# Zip up the iOS and Android binaries +zip -r -X lnc-${TAG}-ios.zip ios/ +zip -r -X lnc-${TAG}-android.zip android/ + +# Remove the iOS and Android dirs after zipping +rm -rf ios/ +rm -rf android/ + +# Create manifest file +shasum -a 256 * >> "manifest-${TAG}.txt" + +popd \ No newline at end of file