Skip to content

Feat: Build and publish dmg(macOS) through github action #65

Feat: Build and publish dmg(macOS) through github action

Feat: Build and publish dmg(macOS) through github action #65

name: Iris Wallet Desktop CI
on:
push:
tags:
- '*' # Trigger this workflow on any tag push
jobs:
build-iris-wallet-desktop-linux:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository with submodules
uses: actions/checkout@v3
with:
submodules: true # Include submodules in the checkout
fetch-depth: 1 # Fetch the latest commit only
- name: Validate Tag and Code Version
run: |
TAG_VERSION=$(git describe --tags)
echo "TAG_VERSION=${TAG_VERSION}" >> $GITHUB_ENV
# Extract version from tag
echo "Tag version: $TAG_VERSION"
# Extract version from code
CODE_VERSION=$(grep '__version__' ./src/version.py | awk -F'=' '{print $2}' | tr -d ' "' | xargs)
echo "Code version: $CODE_VERSION"
# Compare the tag and code version
if [ "$TAG_VERSION" != "$CODE_VERSION" ]; then
echo "❌ Tag version ($TAG_VERSION) does not match code version ($CODE_VERSION)."
exit 1
else
echo "✅ Tag version matches code version."
fi
- name: Install Rust Programming Environment
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
source "$HOME/.cargo/env"
- name: Set up Python 3.12.3 environment
uses: actions/setup-python@v5
with:
python-version: "3.12.3"
- name: Install required system dependencies
run: |
sudo apt update
sudo apt install libxcb-cursor0 -y # Required by the application
sudo apt-get install ruby-dev build-essential -y && sudo gem i fpm -f
sudo apt-get update && sudo apt-get install -y libfuse2 # Required for AppImage creation
- name: Clone rgb-lightning-node repository with submodules
run: git clone https://github.com/RGB-Tools/rgb-lightning-node --recurse-submodules --shallow-submodules
- name: Build the rgb-lightning-node binary
working-directory: rgb-lightning-node
run: cargo install --locked --debug --path .
- name: Copy rgb-lightning-node binary to root directory
run: |
mkdir ln_node_binary
cp rgb-lightning-node/target/debug/rgb-lightning-node ln_node_binary
- name: Set environment variables from GitHub Secrets and generate config.py
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
PROJECT_ID: ${{ secrets.PROJECT_ID }}
AUTH_URI: ${{ secrets.AUTH_URI }}
TOKEN_URI: ${{ secrets.TOKEN_URI }}
AUTH_PROVIDER_CERT_URL: ${{ secrets.AUTH_PROVIDER_CERT_URL }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
run: |
cd src/utils
python generate_config.py
- name: Install Python dependencies
run: |
pip install poetry # Dependency management tool
pip install pyinstaller # Required for building executable files
poetry install # Install application dependencies
- name: Compile QT resources
run: |
poetry run pyside6-rcc src/resources.qrc -o src/resources_rc.py
- name: Create AppImage for Regtest network
run: |
ARCH=$(uname -m)
VERSION=$(grep '__version__' src/version.py | cut -d "'" -f 2)
poetry run build-iris-wallet --network=regtest --distribution=appimage
REGTEST_APPIMAGE_NAME="iriswallet-${VERSION}-${ARCH}.AppImage"
RENAME_REGTEST_APPIMAGE_NAME="iriswallet-${VERSION}-regtest-${ARCH}.AppImage"
mv ${REGTEST_APPIMAGE_NAME} ${RENAME_REGTEST_APPIMAGE_NAME}
echo "RENAME_REGTEST_APPIMAGE_NAME=${RENAME_REGTEST_APPIMAGE_NAME}" >> $GITHUB_ENV
chmod +x $RENAME_REGTEST_APPIMAGE_NAME
echo "Generated file: $RENAME_REGTEST_APPIMAGE_NAME"
shell: bash
- name: Upload Regtest AppImage artifact
uses: actions/upload-artifact@v4
with:
name: linux_appimage_regtest
path: ${{ env.RENAME_REGTEST_APPIMAGE_NAME }}
- name: Create AppImage for Testnet network
run: |
ARCH=$(uname -m)
VERSION=$(grep '__version__' src/version.py | cut -d "'" -f 2)
poetry run build-iris-wallet --network=testnet --distribution=appimage
TESTNET_APPIMAGE_NAME="iriswallet-${VERSION}-${ARCH}.AppImage"
RENAME_TESTNET_APPIMAGE_NAME="iriswallet-${VERSION}-testnet-${ARCH}.AppImage"
mv ${TESTNET_APPIMAGE_NAME} ${RENAME_TESTNET_APPIMAGE_NAME}
echo "RENAME_TESTNET_APPIMAGE_NAME=${RENAME_TESTNET_APPIMAGE_NAME}" >> $GITHUB_ENV
chmod +x $RENAME_TESTNET_APPIMAGE_NAME
echo "Generated file: $RENAME_TESTNET_APPIMAGE_NAME"
shell: bash
- name: Upload Testnet AppImage artifact
uses: actions/upload-artifact@v4
with:
name: linux_appimage_testnet
path: ${{ env.RENAME_TESTNET_APPIMAGE_NAME }}
build-iris-wallet-desktop-macos:
runs-on: macos-latest
steps:
- name: Checkout code with submodules
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 1
- name: Validate Tag and Code Version
run: |
TAG_VERSION=$(git describe --tags)
echo "TAG_VERSION=${TAG_VERSION}" >> $GITHUB_ENV
# Extract version from tag
echo "Tag version: $TAG_VERSION"
# Extract version from code
CODE_VERSION=$(grep '__version__' ./src/version.py | awk -F'=' '{print $2}' | tr -d ' "' | xargs)
echo "Code version: $CODE_VERSION"
# Compare the tag and code version
if [ "$TAG_VERSION" != "$CODE_VERSION" ]; then
echo "❌ Tag version ($TAG_VERSION) does not match code version ($CODE_VERSION)."
exit 1
else
echo "✅ Tag version matches code version."
fi
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
source "$HOME/.cargo/env"
- name: Set up Python 3.12.3
uses: actions/setup-python@v5
with:
python-version: "3.12.3"
- name: Clone rgb-lightning-node repository with submodules
run: git clone https://github.com/RGB-Tools/rgb-lightning-node --recurse-submodules --shallow-submodules
- name: Build the rgb-lightning-node binary
working-directory: rgb-lightning-node
run: cargo install --locked --debug --path .
- name: Copy rgb-lightning-node binary to root directory
run: |
mkdir ln_node_binary
cp rgb-lightning-node/target/debug/rgb-lightning-node ln_node_binary
- name: Set environment variables from secrets and create config.py
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
PROJECT_ID: ${{ secrets.PROJECT_ID }}
AUTH_URI: ${{ secrets.AUTH_URI }}
TOKEN_URI: ${{ secrets.TOKEN_URI }}
AUTH_PROVIDER_CERT_URL: ${{ secrets.AUTH_PROVIDER_CERT_URL }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
run: |
cd src/utils
python generate_config.py
- name: Install python dependencies
run: |
pip install poetry
pip install pyinstaller
poetry install
- name: Compile QT resources
run: |
poetry run pyside6-rcc src/resources.qrc -o src/resources_rc.py
- name: Build the application
run: |
# Build the regtest application for macOS
poetry run build-iris-wallet --network=regtest
# Build the testnet application for macOS
poetry run build-iris-wallet --network=testnet
- name: Upload macOS artifact
uses: actions/upload-artifact@v4
with:
name: macos
path: iriswallet-*
release-artifacts:
if: needs.build-iris-wallet-desktop-macos.result == 'success' && needs.build-iris-wallet-desktop-linux.result == 'success'
runs-on: ubuntu-24.04
needs: [build-iris-wallet-desktop-macos, build-iris-wallet-desktop-linux]
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Retrieve tag name
run: |
TAG_NAME=$(git describe --tags)
echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_ENV
echo "Using tag: $TAG_NAME"
- name: Prepare uploads folder
run: mkdir -p ./uploads
- name: Download macOS artifact
uses: actions/download-artifact@v4
with:
name: macos # Name of the macOS artifact
path: ./uploads # Destination path folder
- name: Download Testnet AppImage artifact
uses: actions/download-artifact@v4
with:
name: linux_appimage_testnet
path: ./uploads
- name: Download Regtest AppImage artifact
uses: actions/download-artifact@v4
with:
name: linux_appimage_regtest
path: ./uploads
- name: Extract Version and Artifacts Info
run: |
VERSION=$(grep '__version__' src/version.py | cut -d "'" -f 2)
echo "TESTNET_APPIMAGE_NAME=${TESTNET_APPIMAGE_NAME}" >> $GITHUB_ENV
echo "REGTEST_APPIMAGE_NAME=${REGTEST_APPIMAGE_NAME}" >> $GITHUB_ENV
cd uploads
REGTEST_APPNAME_MAC=$(ls iriswallet-${VERSION}-regtest-*.dmg 2>/dev/null || echo "")
TESTNET_APPNAME_MAC=$(ls iriswallet-${VERSION}-testnet-*.dmg 2>/dev/null || echo "")
TESTNET_APPIMAGE_NAME=$(ls iriswallet-${VERSION}-regtest-*.AppImage 2>/dev/null || echo "")
REGTEST_APPIMAGE_NAME=$(ls iriswallet-${VERSION}-testnet-*.AppImage 2>/dev/null || echo "")
echo "REGTEST_APPNAME_MAC=${REGTEST_APPNAME_MAC}" >> $GITHUB_ENV
echo "TESTNET_APPNAME_MAC=${TESTNET_APPNAME_MAC}" >> $GITHUB_ENV
echo "REGTEST_APPIMAGE_NAME=${REGTEST_APPIMAGE_NAME}" >> $GITHUB_ENV
echo "TESTNET_APPIMAGE_NAME=${TESTNET_APPIMAGE_NAME}" >> $GITHUB_ENV
- name: Create GitHub Release and Upload Assets
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.TAG_NAME }}
files: |
./uploads/${{ env.REGTEST_APPNAME_MAC }}
./uploads/${{ env.TESTNET_APPNAME_MAC }}
./uploads/${{ env.TESTNET_APPIMAGE_NAME }}
./uploads/${{ env.REGTEST_APPIMAGE_NAME }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
cleanup-artifacts:
if: always()
runs-on: ubuntu-22.04
needs: [build-iris-wallet-desktop-macos, build-iris-wallet-desktop-linux, release-artifacts]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Delete Artifacts from Workflow Run
uses: geekyeggo/delete-artifact@v5
with:
name: |
macos
linux_appimage_regtest
linux_appimage_testnet
failOnError: false