Merge pull request #1295 from getlipa/feature/cache-both-lsp-fee-params #352
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy a new release | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
env: | |
GITHUB_REF: ${{ github.ref }} | |
jobs: | |
cross-compile-ios: | |
name: cross-compile-ios | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
target: [ x86_64-apple-ios, aarch64-apple-ios, aarch64-apple-ios-sim ] | |
mock-deps: [ false, true ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Config cargo | |
run: echo -e "$CARGO_CONFIG_TOML_BREEZ" > .cargo/config.toml | |
env: | |
CARGO_CONFIG_TOML_BREEZ: ${{ secrets.CARGO_CONFIG_TOML_BREEZ }} | |
- name: Install rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: 1.83.0 | |
profile: minimal | |
override: true | |
target: ${{ matrix.target }} | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build target | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: false | |
command: build | |
args: ${{ matrix.mock-deps && '--no-default-features --features mock-deps' || '' }} --release --target ${{ matrix.target }} | |
env: | |
IPHONEOS_DEPLOYMENT_TARGET: 16.2 | |
- name: Upload library binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
path: target/${{ matrix.target }}/release/libuniffi_lipalightninglib.a | |
name: build-${{ matrix.target }}${{ matrix.mock-deps && '-mock' || '' }} | |
- name: Upload bindings files | |
uses: actions/upload-artifact@v4 | |
if: ${{ matrix.target == 'x86_64-apple-ios' }} | |
with: | |
path: bindings/swift/lipalightninglib* | |
name: bindings-files-ios${{ matrix.mock-deps && '-mock' || '' }} | |
cross-compile-android: | |
name: cross-compile-android | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target: [ aarch64-linux-android, armv7-linux-androideabi, i686-linux-android ] | |
mock-deps: [ false, true ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Config cargo | |
run: echo -e "$CARGO_CONFIG_TOML_BREEZ" > .cargo/config.toml | |
env: | |
CARGO_CONFIG_TOML_BREEZ: ${{ secrets.CARGO_CONFIG_TOML_BREEZ }} | |
- name: Install rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: 1.83.0 | |
profile: minimal | |
override: true | |
target: ${{ matrix.target }} | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install Cross | |
run: cargo install cross --locked | |
- name: Build target | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: true | |
command: build | |
args: ${{ matrix.mock-deps && '--no-default-features --features mock-deps' || '' }} --release --target ${{ matrix.target }} | |
- name: Upload library binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
path: target/${{ matrix.target }}/release/libuniffi_lipalightninglib.so | |
name: build-${{ matrix.target }}${{ matrix.mock-deps && '-mock' || '' }} | |
- name: Upload bindings file | |
uses: actions/upload-artifact@v4 | |
if: ${{ matrix.target == 'aarch64-linux-android' }} | |
with: | |
path: bindings/kotlin/uniffi/lipalightninglib/lipalightninglib.kt | |
name: bindings-file-android${{ matrix.mock-deps && '-mock' || '' }} | |
lipo-ios: | |
name: lipo-ios | |
needs: [ cross-compile-ios, cross-compile-android ] | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
mock-deps: [ false, true ] | |
steps: | |
- name: Download x86 bin | |
uses: actions/download-artifact@v4 | |
with: | |
path: target/x86_64-apple-ios/release | |
name: build-x86_64-apple-ios${{ matrix.mock-deps && '-mock' || '' }} | |
- name: Download aarch64 bin | |
uses: actions/download-artifact@v4 | |
with: | |
path: target/aarch64-apple-ios/release | |
name: build-aarch64-apple-ios${{ matrix.mock-deps && '-mock' || '' }} | |
- name: Download aarch64sim bin | |
uses: actions/download-artifact@v4 | |
with: | |
path: target/aarch64-apple-ios-sim/release | |
name: build-aarch64-apple-ios-sim${{ matrix.mock-deps && '-mock' || '' }} | |
- name: Package simulator binaries | |
run: | | |
mkdir -p target/universal/release | |
lipo -create -output target/universal/release/libuniffi_lipalightninglib_simulator.a \ | |
target/aarch64-apple-ios-sim/release/libuniffi_lipalightninglib.a \ | |
target/x86_64-apple-ios/release/libuniffi_lipalightninglib.a | |
- name: Upload universal binary | |
uses: actions/upload-artifact@v4 | |
with: | |
path: target/universal/release/libuniffi_lipalightninglib_simulator.a | |
name: build-ios-simulator-universal${{ matrix.mock-deps && '-mock' || '' }} | |
deploy-ios: | |
name: deploy-ios | |
needs: lipo-ios | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
mock-deps: [ false, true ] | |
max-parallel: 1 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set env | |
run: | | |
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
raw=$(git branch -r --contains ${{ github.ref }}) | |
branch=${raw##*/} | |
echo "BRANCH=$branch" >> $GITHUB_ENV | |
- uses: webfactory/ssh-agent@v0.5.4 | |
with: | |
ssh-private-key: ${{ secrets.LIPA_BOT_IOS_DEPLOY_KEY }} | |
- name: Import bot's GPG key for signing commits | |
id: import-gpg | |
uses: crazy-max/ghaction-import-gpg@v4 | |
with: | |
gpg_private_key: ${{ secrets.LIPA_BOT_GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.LIPA_BOT_GPG_PASSPHRASE }} | |
git_config_global: true | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
- name: Download aarch64 bin | |
uses: actions/download-artifact@v4 | |
with: | |
path: target/aarch64-apple-ios/release | |
name: build-aarch64-apple-ios${{ matrix.mock-deps && '-mock' || '' }} | |
- name: Download simulator universal bin | |
uses: actions/download-artifact@v4 | |
with: | |
path: target/universal/release | |
name: build-ios-simulator-universal${{ matrix.mock-deps && '-mock' || '' }} | |
- name: Download bindings files | |
uses: actions/download-artifact@v4 | |
with: | |
path: bindings/swift/ | |
name: bindings-files-ios${{ matrix.mock-deps && '-mock' || '' }} | |
- name: Create xcframework | |
run: | | |
git clone git@github.com:getlipa/lipa-lightning-lib-swift.git | |
cd lipa-lightning-lib-swift | |
cp Info.plist.framework_template Info.plist | |
sed -i "s/to_replace_version/$(echo "${{env.RELEASE_VERSION}}${{ matrix.mock-deps && '-mock' || '' }}" | tr -cd '0-9.')/g" Info.plist | |
cp Info.plist lipalightninglibFFI.xcframework/ios-arm64/lipalightninglibFFI.framework/Info.plist | |
mv Info.plist lipalightninglibFFI.xcframework/ios-arm64_x86_64-simulator/lipalightninglibFFI.framework/Info.plist | |
cd .. | |
cp bindings/swift/lipalightninglibFFI.h lipa-lightning-lib-swift/lipalightninglibFFI.xcframework/ios-arm64/lipalightninglibFFI.framework/Headers/lipalightninglibFFI.h | |
cp bindings/swift/lipalightninglibFFI.h lipa-lightning-lib-swift/lipalightninglibFFI.xcframework/ios-arm64_x86_64-simulator/lipalightninglibFFI.framework/Headers/lipalightninglibFFI.h | |
cp target/aarch64-apple-ios/release/libuniffi_lipalightninglib.a lipa-lightning-lib-swift/lipalightninglibFFI.xcframework/ios-arm64/lipalightninglibFFI.framework/lipalightninglibFFI | |
cp target/universal/release/libuniffi_lipalightninglib_simulator.a lipa-lightning-lib-swift/lipalightninglibFFI.xcframework/ios-arm64_x86_64-simulator/lipalightninglibFFI.framework/lipalightninglibFFI | |
cd lipa-lightning-lib-swift | |
zip -9 -r lipalightninglibFFI.xcframework.zip lipalightninglibFFI.xcframework | |
- name: Push to target repo | |
env: | |
GITHUB_TOKEN: ${{ secrets.LIPA_BOT_ACCESS_TOKEN }} | |
run: | | |
cd lipa-lightning-lib-swift | |
git config --global user.email "lipa-lightning-engineering@getlipa.com" | |
git config --global user.name "lipa Bot" | |
cp ../bindings/swift/lipalightninglib.swift Sources/LipaLightningLib/LipaLightningLib.swift | |
cp Package.swift.template Package.swift | |
shasum -a 256 lipalightninglibFFI.xcframework.zip | sed 's/ .*//' > checksum | |
sed -i "s/to_replace_release_version/${{ env.RELEASE_VERSION }}${{ matrix.mock-deps && '-mock' || '' }}/g" Package.swift | |
sed -i "s/to_replace_zip_checksum/$(cat checksum)/g" Package.swift | |
git add Package.swift | |
git add Sources/LipaLightningLib/LipaLightningLib.swift | |
git add lipalightninglibFFI.xcframework/ios-arm64/lipalightninglibFFI.framework/Info.plist | |
git add lipalightninglibFFI.xcframework/ios-arm64_x86_64-simulator/lipalightninglibFFI.framework/Info.plist | |
git commit -m "This commit was created automatically by the lipa bot" | |
git restore . | |
git pull --rebase | |
git tag -a ${{ env.RELEASE_VERSION }}${{ matrix.mock-deps && '-mock' || '' }} HEAD -m "This tag was created automatically by the lipa bot." | |
git push | |
git push --tag | |
- name: Create release | |
env: | |
GITHUB_TOKEN: ${{ secrets.LIPA_BOT_ACCESS_TOKEN }} | |
if: ${{ env.BRANCH == 'main' }} | |
run: | | |
cd lipa-lightning-lib-swift | |
gh release create ${{ env.RELEASE_VERSION }}${{ matrix.mock-deps && '-mock' || '' }} \ | |
lipalightninglibFFI.xcframework.zip \ | |
--title "${{ env.RELEASE_VERSION }}${{ matrix.mock-deps && '-mock' || '' }}" \ | |
--notes "This release was created automatically by the lipa bot. For more information, please access the corresponding release in https://github.com/getlipa/lipa-lightning-lib" | |
- name: Create pre-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.LIPA_BOT_ACCESS_TOKEN }} | |
if: ${{ env.BRANCH != 'main' }} | |
run: | | |
cd lipa-lightning-lib-swift | |
gh release create ${{ env.RELEASE_VERSION }}${{ matrix.mock-deps && '-mock' || '' }} \ | |
lipalightninglibFFI.xcframework.zip \ | |
--title "${{ env.RELEASE_VERSION }}${{ matrix.mock-deps && '-mock' || '' }}" \ | |
--notes "This pre-release was created automatically by the lipa bot. For more information, please access the corresponding release in https://github.com/getlipa/lipa-lightning-lib" \ | |
--prerelease | |
deploy-android: | |
name: deploy-android | |
needs: lipo-ios | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
mock-deps: [ false, true ] | |
max-parallel: 1 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set env | |
run: | | |
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
raw=$(git branch -r --contains ${{ github.ref }}) | |
branch=${raw##*/} | |
echo "BRANCH=$branch" >> $GITHUB_ENV | |
- uses: webfactory/ssh-agent@v0.5.4 | |
with: | |
ssh-private-key: ${{ secrets.LIPA_BOT_ANDROID_DEPLOY_KEY }} | |
- name: Import bot's GPG key for signing commits | |
id: import-gpg | |
uses: crazy-max/ghaction-import-gpg@v4 | |
with: | |
gpg_private_key: ${{ secrets.LIPA_BOT_GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.LIPA_BOT_GPG_PASSPHRASE }} | |
git_config_global: true | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
- name: Download aarch64 bin | |
uses: actions/download-artifact@v4 | |
with: | |
path: target/aarch64-linux-android/release | |
name: build-aarch64-linux-android${{ matrix.mock-deps && '-mock' || '' }} | |
- name: Download armv7 bin | |
uses: actions/download-artifact@v4 | |
with: | |
path: target/armv7-linux-androideabi/release | |
name: build-armv7-linux-androideabi${{ matrix.mock-deps && '-mock' || '' }} | |
- name: Download i686 bin | |
uses: actions/download-artifact@v4 | |
with: | |
path: target/i686-linux-android/release | |
name: build-i686-linux-android${{ matrix.mock-deps && '-mock' || '' }} | |
- name: Download bindings file | |
uses: actions/download-artifact@v4 | |
with: | |
path: bindings/kotlin/uniffi/lipalightninglib | |
name: bindings-file-android${{ matrix.mock-deps && '-mock' || '' }} | |
- name: Push to target repo | |
run: | | |
git clone git@github.com:getlipa/lipa-lightning-lib-android.git | |
cd lipa-lightning-lib-android | |
git config --global user.email "lipa-lightning-engineering@getlipa.com" | |
git config --global user.name "lipa Bot" | |
cp ../bindings/kotlin/uniffi/lipalightninglib/lipalightninglib.kt LipaLightningLib/src/main/java/com/getlipa/lipalightninglib/lipalightninglib.kt | |
mkdir -p jniLibs/arm64-v8a | |
mkdir -p jniLibs/armeabi-v7a | |
mkdir -p jniLibs/x86 | |
wget https://dl.google.com/android/repository/android-ndk-r25c-windows.zip | |
unzip android-ndk-r25c-windows.zip | |
mv android-ndk-r25c/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so jniLibs/arm64-v8a | |
mv android-ndk-r25c/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/arm-linux-androideabi/libc++_shared.so jniLibs/armeabi-v7a | |
mv android-ndk-r25c/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/lib/i686-linux-android/libc++_shared.so jniLibs/x86 | |
cp ../target/aarch64-linux-android/release/libuniffi_lipalightninglib.so jniLibs/arm64-v8a | |
cp ../target/armv7-linux-androideabi/release/libuniffi_lipalightninglib.so jniLibs/armeabi-v7a | |
cp ../target/i686-linux-android/release/libuniffi_lipalightninglib.so jniLibs/x86 | |
zip -r jniLibs.zip jniLibs | |
shasum -a 256 jniLibs.zip | sed 's/ .*//' > checksum | |
cp jitpack.yml.template jitpack.yml | |
sed -i "s/to_replace_release_version/${{ env.RELEASE_VERSION }}${{ matrix.mock-deps && '-mock' || '' }}/g" jitpack.yml | |
sed -i "s/to_replace_zip_checksum/$(cat checksum)/g" jitpack.yml | |
git add LipaLightningLib/src/main/java/com/getlipa/lipalightninglib/lipalightninglib.kt | |
git add jitpack.yml | |
git commit -m "This commit was created automatically by the lipa bot" | |
git pull --rebase | |
git tag -a ${{ env.RELEASE_VERSION }}${{ matrix.mock-deps && '-mock' || '' }} HEAD -m "This tag was created automatically by the lipa bot." | |
git push | |
git push --tag | |
- name: Create release | |
env: | |
GITHUB_TOKEN: ${{ secrets.LIPA_BOT_ACCESS_TOKEN }} | |
if: ${{ env.BRANCH == 'main' }} | |
run: | | |
cd lipa-lightning-lib-android | |
gh release create ${{ env.RELEASE_VERSION }}${{ matrix.mock-deps && '-mock' || '' }} \ | |
jniLibs.zip \ | |
--title "${{ env.RELEASE_VERSION }}${{ matrix.mock-deps && '-mock' || '' }}" \ | |
--notes "This release was created automatically by the lipa bot. For more information, please access the corresponding release in https://github.com/getlipa/lipa-lightning-lib" | |
- name: Create pre-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.LIPA_BOT_ACCESS_TOKEN }} | |
if: ${{ env.BRANCH != 'main' }} | |
run: | | |
cd lipa-lightning-lib-android | |
gh release create ${{ env.RELEASE_VERSION }}${{ matrix.mock-deps && '-mock' || '' }} \ | |
jniLibs.zip \ | |
--title "${{ env.RELEASE_VERSION }}${{ matrix.mock-deps && '-mock' || '' }}" \ | |
--notes "This pre-release was created automatically by the lipa bot. For more information, please access the corresponding release in https://github.com/getlipa/lipa-lightning-lib" \ | |
--prerelease | |
- name: Trigger JitPack build | |
run: | | |
curl -s -m 30 https://jitpack.io/com/github/getlipa/lipa-lightning-lib-android/${{ env.RELEASE_VERSION }}${{ matrix.mock-deps && '-mock' || '' }} || true | |
determine-branch: | |
name: determine-branch | |
needs: | |
- deploy-ios | |
- deploy-android | |
runs-on: ubuntu-latest | |
outputs: | |
is_main: ${{ steps.set-var.outputs.is_main }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Get Branch Name | |
id: get-branch | |
run: | | |
BRANCH_NAMES=$(git branch -r --contains ${GITHUB_REF_NAME} | grep origin | sed 's/origin\///' | sed 's/ //g' | sed ':a;N;$!ba;s/\n//g') | |
echo "BRANCH_NAMES=$BRANCH_NAMES" >> "$GITHUB_ENV" | |
echo "Branch names: $BRANCH_NAMES" | |
- name: Set Output Variable | |
id: set-var | |
run: | | |
if [[ $BRANCH_NAMES == *'main'* ]]; then | |
echo "::set-output name=is_main::true" | |
echo "Setting is_main to true" | |
else | |
echo "::set-output name=is_main::false" | |
echo "Setting is_main to false" | |
fi | |
build-docs: | |
name: build-docs | |
needs: | |
- determine-branch | |
if: needs.determine-branch.outputs.is_main == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Config cargo | |
run: echo -e "$CARGO_CONFIG_TOML_BREEZ" > .cargo/config.toml | |
env: | |
CARGO_CONFIG_TOML_BREEZ: ${{ secrets.CARGO_CONFIG_TOML_BREEZ }} | |
- name: Install rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: 1.83.0 | |
profile: minimal | |
override: true | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Docs | |
run: make doc | |
# Set the right file permissions, based on https://github.com/actions/upload-pages-artifact#file-permissions | |
- name: Fix file permissions | |
shell: sh | |
run: | | |
chmod -c -R +rX "./libs/target/doc/" | while read line; do | |
echo "::warning title=Invalid file permissions automatically fixed::$line" | |
done | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: './target/doc' | |
deploy-docs: | |
name: deploy-docs | |
needs: build-docs | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |