Skip to content

Commit

Permalink
Merge #251: Release script
Browse files Browse the repository at this point in the history
c5f38ec contrib: add a script to produce the assets to be released (Antoine Poinsot)
e7f4349 contrib: utilities for releasing a macOS application in a dmg (Antoine Poinsot)

Pull request description:

  This adds a script to produce the binaries and packages we will be releasing. It:
  1. Runs the deterministic build for each platform
  2. Package them nicely according to the platform's requirements
  3. Create a detached sig for each asset with my key, `590B 7292 695A FFA5 B672  CBB2 E13F C145 CD3F 4304`

  Thanks to the Bitcoin Core project for the work on creating a neat `.dmg`, i mostly stole what's here from there.

  Fixes #42.

ACKs for top commit:
  darosior:
    ACK c5f38ec

Tree-SHA512: 98c92ca51fa0893541ce246cd0ca0e1e6e99f9a56aa70269d4c8e67122116adb282fc49995beee4be6fc3ed53fcb1fb93274b29588084b3ef0c9187cd7e205ad
  • Loading branch information
darosior committed Dec 18, 2022
2 parents aecb063 + c5f38ec commit b63416b
Show file tree
Hide file tree
Showing 5 changed files with 203 additions and 0 deletions.
Binary file not shown.
69 changes: 69 additions & 0 deletions contrib/release/macos/dmg_template/Liana.app/Contents/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<dict>
<key>LSMinimumSystemVersion</key>
<string>10.15.0</string>

<key>LSArchitecturePriority</key>
<array>
<string>x86_64</string>
</array>

<!-- TODO -->
<!--<key>CFBundleIconFile</key>-->
<!--<string></string>-->

<key>CFBundlePackageType</key>
<string>APPL</string>

<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>

<key>CFBundleShortVersionString</key>
<string>VERSION_PLACEHOLDER</string>

<key>CFBundleVersion</key>
<string>VERSION_PLACEHOLDER</string>

<key>CFBundleSignature</key>
<string>????</string>

<key>CFBundleExecutable</key>
<string>Liana</string>

<key>CFBundleName</key>
<string>Liana</string>

<key>LSHasLocalizedDisplayName</key>
<true/>

<key>CFBundleIdentifier</key>
<string>org.wizardsardine.liana</string>

<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>org.wizardsardine.liana</string>
<key>CFBundleURLSchemes</key>
<array>
<string>liana</string>
</array>
</dict>
</array>

<key>NSPrincipalClass</key>
<string>NSApplication</string>

<key>NSHighResolutionCapable</key>
<string>True</string>

<key>LSApplicationCategoryType</key>
<string>public.app-category.finance</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
APPL????
51 changes: 51 additions & 0 deletions contrib/release/macos/gen_dstore.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
"""
Script to generate a .DS_Store within the dmg folder to have a neat fancy window
when installing the software on macOS.
This was taken and adapted from the Bitcoin Core 'macdeployqtplus' script.
https://github.com/bitcoin/bitcoin/blob/cb32328d1b80d0ccd6eb9532bd8fe4e0a4de385e/contrib/macdeploy/macdeployqtplus
"""

from ds_store import DSStore
from mac_alias import Alias


output_file = ".DS_Store"

ds = DSStore.open(output_file, "w+")

ds["."]["bwsp"] = {
"WindowBounds": "{{300, 280}, {500, 343}}",
"PreviewPaneVisibility": False,
}

icvp = {
"gridOffsetX": 0.0,
"textSize": 12.0,
"viewOptionsVersion": 1,
"backgroundImageAlias": b"\x00\x00\x00\x00\x02\x1e\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd1\x94\\\xb0H+\x00\x05\x00\x00\x00\x98\x0fbackground.tiff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x99\xd19\xb0\xf8\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\r\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b.background\x00\x00\x10\x00\x08\x00\x00\xd1\x94\\\xb0\x00\x00\x00\x11\x00\x08\x00\x00\xd19\xb0\xf8\x00\x00\x00\x01\x00\x04\x00\x00\x00\x98\x00\x0e\x00 \x00\x0f\x00b\x00a\x00c\x00k\x00g\x00r\x00o\x00u\x00n\x00d\x00.\x00t\x00i\x00f\x00f\x00\x0f\x00\x02\x00\x00\x00\x12\x00\x1c/.background/background.tiff\x00\x14\x01\x06\x00\x00\x00\x00\x01\x06\x00\x02\x00\x00\x0cMacintosh HD\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xce\x97\xab\xc3H+\x00\x00\x01\x88[\x88\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02u\xab\x8d\xd1\x94\\\xb0devrddsk\xff\xff\xff\xff\x00\x00\t \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07bitcoin\x00\x00\x10\x00\x08\x00\x00\xce\x97\xab\xc3\x00\x00\x00\x11\x00\x08\x00\x00\xd1\x94\\\xb0\x00\x00\x00\x01\x00\x14\x01\x88[\x88\x00\x16\xa9\t\x00\x08\xfaR\x00\x08\xfaQ\x00\x02d\x8e\x00\x0e\x00\x02\x00\x00\x00\x0f\x00\x1a\x00\x0c\x00M\x00a\x00c\x00i\x00n\x00t\x00o\x00s\x00h\x00 \x00H\x00D\x00\x13\x00\x01/\x00\x00\x15\x00\x02\x00\x14\xff\xff\x00\x00\xff\xff\x00\x00",
"backgroundColorBlue": 1.0,
"iconSize": 96.0,
"backgroundColorGreen": 1.0,
"arrangeBy": "none",
"showIconPreview": True,
"gridSpacing": 100.0,
"gridOffsetY": 0.0,
"showItemInfo": False,
"labelOnBottom": True,
"backgroundType": 2,
"backgroundColorRed": 1.0,
}
alias = Alias().from_bytes(icvp["backgroundImageAlias"])
alias.volume.name = "Liana"
alias.volume.posix_path = "/Volumes/Liana"
icvp["backgroundImageAlias"] = alias.to_bytes()
ds["."]["icvp"] = icvp

ds["."]["vSrn"] = ("long", 1)

ds["Applications"]["Iloc"] = (370, 156)
ds["Liana.app"]["Iloc"] = (128, 156)

ds.flush()
ds.close()
82 changes: 82 additions & 0 deletions contrib/release/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#!/usr/bin/env sh

# ==============================================================================
# Script for creating and signing the release assets. To be ran from the root of
# the repository.
# ==============================================================================

set -ex

VERSION="${VERSION:-"0.1"}"
LIANA_PREFIX="liana-$VERSION"
LINUX_DIR_NAME="$LIANA_PREFIX-x86_64-linux-gnu"
LINUX_ARCHIVE="$LINUX_DIR_NAME.tar.gz"
WINDOWS_DIR_NAME="$LIANA_PREFIX-x86_64-windows-gnu"
WINDOWS_ARCHIVE="$WINDOWS_DIR_NAME.zip"
MAC_DIR_NAME="$LIANA_PREFIX-x86_64-apple-darwin"
MAC_ARCHIVE="$MAC_DIR_NAME.tar.gz"

create_dir() {
test -d "$1" || mkdir "$1"
}

# We'll use a folder for the builds output and another one for the final assets.
RELEASE_DIR="$PWD/release_assets"
BUILD_DIR="$PWD/release_build"
create_dir "$RELEASE_DIR"
create_dir "$BUILD_DIR"

OUT_DIR="$BUILD_DIR" ./contrib/reproducible/guix/guix-build.sh
TARGET_DIR="$BUILD_DIR" ./contrib/reproducible/docker/docker-build.sh

# Create the Linux archive
(
cd "$BUILD_DIR"
create_dir "$LINUX_DIR_NAME"
cp "$BUILD_DIR/release/lianad" "$BUILD_DIR/release/liana-cli" "$BUILD_DIR/gui/release/liana-gui" ../README.md "$LINUX_DIR_NAME"
tar -czf "$LINUX_ARCHIVE" "$LINUX_DIR_NAME"
cp "$LINUX_ARCHIVE" "$RELEASE_DIR"
)

# Create the Windows archive and the raw executable
(
cd "$BUILD_DIR"
create_dir "$WINDOWS_DIR_NAME"
cp "$BUILD_DIR/gui/x86_64-pc-windows-gnu/release/liana-gui.exe" ../README.md "$WINDOWS_DIR_NAME"
zip "$WINDOWS_ARCHIVE" "$WINDOWS_DIR_NAME"
cp "$WINDOWS_ARCHIVE" "$RELEASE_DIR"
cp "$BUILD_DIR/gui/x86_64-pc-windows-gnu/release/liana-gui.exe" "$RELEASE_DIR/$LIANA_PREFIX.exe"
)

# Create the MacOS archive and the DMG
(
cd "$BUILD_DIR"
create_dir "$MAC_DIR_NAME"
cp "$BUILD_DIR/x86_64-apple-darwin/release/lianad" "$BUILD_DIR/x86_64-apple-darwin/release/liana-cli" "$BUILD_DIR/gui/x86_64-apple-darwin/release/liana-gui" ../README.md "$MAC_DIR_NAME"
tar -czf "$MAC_ARCHIVE" "$MAC_DIR_NAME"
cp "$MAC_ARCHIVE" "$RELEASE_DIR"

DMG_DIR="liana-$VERSION"
cp -r ../contrib/release/macos/dmg_template "$DMG_DIR"
sed -i "s/VERSION_PLACEHOLDER/$VERSION/g" "$DMG_DIR/Liana.app/Contents/Info.plist"
ln -s /Applications "$DMG_DIR/Applications"
python3 -m venv venv
. venv/bin/activate
pip install ds_store mac_alias
python3 ../contrib/release/macos/gen_dstore.py
mv .DS_Store "$DMG_DIR/"
cp "$BUILD_DIR/gui/x86_64-apple-darwin/release/liana-gui" "$DMG_DIR/Liana.app/Contents/MacOS/"
DMG_FILE="liana-$VERSION.dmg"
xorrisofs -D -l -V Liana -no-pad -r -dir-mode 0755 -o "$DMG_FILE" "$DMG_DIR"
cp "$DMG_FILE" "$RELEASE_DIR/"
)

# Finally, sign all the assets
(
cd "$RELEASE_DIR"
for asset in $(ls); do
gpg --detach-sign --armor "$asset"
done
)

set +ex

0 comments on commit b63416b

Please sign in to comment.