Skip to content

Commit e332cb8

Browse files
authored
Merge pull request #75 from lightninglabs/release-doc
doc: automate and document release process
2 parents 12ce03a + 5b59978 commit e332cb8

File tree

3 files changed

+112
-4
lines changed

3 files changed

+112
-4
lines changed

Makefile

+14-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ LINT = $(LINT_BIN) run -v --build-tags itest
3030

3131
PKG := github.com/lightninglabs/lightning-node-connect
3232
MOBILE_PKG := $(PKG)/mobile
33-
MOBILE_BUILD_DIR :=${GOPATH}/src/$(PKG)/build
33+
MKFILE_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
34+
MOBILE_BUILD_DIR := $(MKFILE_DIR)/build
3435
IOS_BUILD_DIR := $(MOBILE_BUILD_DIR)/ios
3536
IOS_BUILD := $(IOS_BUILD_DIR)/Lncmobile.xcframework
3637
ANDROID_BUILD_DIR := $(MOBILE_BUILD_DIR)/android
@@ -76,13 +77,18 @@ wasm:
7677
cd cmd/wasm-client; CGO_ENABLED=0 GOOS=js GOARCH=wasm go build -trimpath -ldflags="$(LDFLAGS)" -tags="$(RPC_TAGS)" -v -o wasm-client.wasm .
7778
$(CP) cmd/wasm-client/wasm-client.wasm example/wasm-client.wasm
7879

80+
clean:
81+
@$(call print, "Cleaning up.")
82+
$(RM) -r $(MOBILE_BUILD_DIR)
83+
$(RM) -r ./reproducible-builds/
84+
7985
apple:
80-
@$(call print, "Building iOS and macOS cxframework ($(IOS_BUILD)).")
86+
@$(call print, "Building iOS and macOS xcframework ($(IOS_BUILD)).")
8187
mkdir -p $(IOS_BUILD_DIR)
8288
cd mobile; $(GOMOBILE_BIN) bind -target=ios,iossimulator,macos -tags="mobile $(DEV_TAGS) $(RPC_TAGS)" $(LDFLAGS_MOBILE) -v -o $(IOS_BUILD) $(MOBILE_PKG)
8389

8490
ios:
85-
@$(call print, "Building iOS cxframework ($(IOS_BUILD)).")
91+
@$(call print, "Building iOS xcframework ($(IOS_BUILD)).")
8692
mkdir -p $(IOS_BUILD_DIR)
8793
cd mobile; $(GOMOBILE_BIN) bind -target=ios,iossimulator -tags="mobile $(DEV_TAGS) $(RPC_TAGS)" $(LDFLAGS_MOBILE) -v -o $(IOS_BUILD) $(MOBILE_PKG)
8894
# modify library files for import without C++ modules
@@ -92,7 +98,7 @@ ios:
9298
sed -i.bak -E "s|$(IOS_STRING1)|$(IOS_STRING2)|g" $(IOS_FILE4)
9399

94100
macos:
95-
@$(call print, "Building macOS cxframework ($(IOS_BUILD)).")
101+
@$(call print, "Building macOS xcframework ($(IOS_BUILD)).")
96102
mkdir -p $(IOS_BUILD_DIR)
97103
cd mobile; $(GOMOBILE_BIN) bind -target=macos -tags="mobile $(DEV_TAGS) $(RPC_TAGS)" $(LDFLAGS_MOBILE) -v -o $(IOS_BUILD) $(MOBILE_PKG)
98104

@@ -120,6 +126,10 @@ repro-wasm:
120126
#Remove the repro-wasm-image
121127
docker image rm repro-wasm-image
122128

129+
release: clean mobile repro-wasm
130+
@$(call print, "Building release binaries for $(tag).")
131+
./scripts/release.sh $(tag)
132+
123133
# =======
124134
# TESTING
125135
# =======

RELEASE.md

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# LNC Release Process
2+
3+
This document describes the steps needed to release a new version of LNC binaries.
4+
5+
### System Requirements
6+
7+
1. Android Studio with Android SDK (API level 16 or newer)
8+
2. Xcode (latest version)
9+
3. Go v1.19.8 or newer
10+
11+
### Build Release Binaries
12+
13+
From the root of the project, run the following command. Replace `vX.Y.Z-alpha`
14+
with the next version number (ex: v0.2.0-alpha)
15+
16+
```sh
17+
$ make release tag=vX.Y.Z-alpha
18+
```
19+
20+
When this completes, a `build` dir will be created with four files:
21+
22+
- **lnc-vX.Y.Z-alpha.wasm**: the WASM reproducible binary
23+
- **lnc-vX.Y.Z-alpha-android.zip**: the gomobile library for android
24+
- **lnc-vX.Y.Z-alpha-ios.zip**: the gomobile library for iOS
25+
- **manifest-vX.Y.Z-alpha.txt**: the sha256 hash manifest file
26+
27+
### Sign the manifest and rename the signature file
28+
29+
#### Sign the manifest file using your PGP key.
30+
31+
- Replace `{PGP_EMAIL}` with your email address associated with your PGP key
32+
- Replace `{GITHUB_USERNAME}` with your github username
33+
34+
```sh
35+
$ gpg --default-key {PGP_EMAIL} --output manifest-{GITHUB_USERNAME}-vX.Y.Z-alpha.sig --detach-sign manifest-vX.Y.Z-alpha.txt
36+
```
37+
38+
### Create a tag and push to Github
39+
40+
Using the `-s` option signs the tag with your PGP key
41+
42+
```sh
43+
$ git tag -s vX.Y.Z-alpha -m "lightning-node-connect vX.Y.Z-alpha"
44+
$ git push origin vX.Y.Z-alpha
45+
```
46+
47+
### Create Github Release
48+
49+
On Github create a new release. Select the tag you just pushed, then click the
50+
"Auto-generate release notes" button.
51+
52+
Take the rest of the content from a previous release. Be sure to update the
53+
version number and update the verification examples to use your own PGP key.
54+
55+
In the assets, include these five files:
56+
57+
- lnc-vX.Y.Z-alpha.wasm
58+
- lnc-vX.Y.Z-alpha-android.zip
59+
- lnc-vX.Y.Z-alpha-ios.zip
60+
- manifest-vX.Y.Z-alpha.txt
61+
- manifest-{GITHUB_USERNAME}-vX.Y.Z-alpha.sig
62+
63+
### Deploy the WASM binary to CDN
64+
65+
The `lnc-vX.Y.Z-alpha.wasm` should be deployed to our CDN so it is available
66+
at the url `https://lightning.engineering/lnc-vX.Y.Z-alpha.wasm`.

scripts/release.sh

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"
6+
BUILD_DIR=${DIR}/../build
7+
TAG=${1}
8+
9+
if [ -z "${TAG}" ]; then
10+
echo "usage: $0 <tag>"
11+
echo "Example: $0 v0.1.0-alpha"
12+
exit 1
13+
fi
14+
15+
pushd ${BUILD_DIR}
16+
17+
# Copy the WASM binary
18+
cp ../reproducible-builds/wasm-client.wasm lnc-${TAG}.wasm
19+
rm -rf ../reproducible-builds/
20+
21+
# Zip up the iOS and Android binaries
22+
zip -r -X lnc-${TAG}-ios.zip ios/
23+
zip -r -X lnc-${TAG}-android.zip android/
24+
25+
# Remove the iOS and Android dirs after zipping
26+
rm -rf ios/
27+
rm -rf android/
28+
29+
# Create manifest file
30+
shasum -a 256 * >> "manifest-${TAG}.txt"
31+
32+
popd

0 commit comments

Comments
 (0)