Build libwallets #407
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: Build libwallets | |
'on': | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]*' | |
branches: | |
- "build-libwallet-*" | |
schedule: | |
- cron: "05 00 * * *" | |
workflow_dispatch: | |
inputs: | |
build_android: | |
type: boolean | |
default: true | |
build_ios: | |
type: boolean | |
default: true | |
toolchain: | |
type: string | |
description: 'Rust toolchain' | |
env: | |
toolchain_default: 'stable' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
builds_envs_setup: | |
runs-on: ubuntu-latest | |
outputs: | |
toolchain: ${{ steps.envs_setup.outputs.toolchain }} | |
build_android: ${{ steps.envs_setup.outputs.build_android }} | |
build_ios: ${{ steps.envs_setup.outputs.build_ios }} | |
steps: | |
- name: envs setup | |
id: envs_setup | |
shell: bash | |
run: | | |
TOOLCHAIN=${{ github.event.inputs.toolchain }} | |
echo "toolchain=${TOOLCHAIN:-${{ env.toolchain_default }}}" >> $GITHUB_OUTPUT | |
BUILD_ANDROID=${{ github.event.inputs.build_android }} | |
echo "build_android=${BUILD_ANDROID:-true}" >> $GITHUB_OUTPUT | |
BUILD_IOS=${{ github.event.inputs.build_ios }} | |
echo "build_ios=${BUILD_IOS:-true}" >> $GITHUB_OUTPUT | |
builds_run: | |
needs: builds_envs_setup | |
uses: ./.github/workflows/build_libwallets_workflow.yml | |
with: | |
toolchain: ${{ needs.builds_envs_setup.outputs.toolchain }} | |
build_android: ${{ needs.builds_envs_setup.outputs.build_android }} | |
build_ios: ${{ needs.builds_envs_setup.outputs.build_ios }} | |
libwallet_uploads: | |
needs: builds_run | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download binaries | |
uses: actions/download-artifact@v3 | |
with: | |
path: libwallets | |
- name: Verify checksums | |
shell: bash | |
working-directory: libwallets | |
run: | | |
ls -alhtR | |
find . -name "*.sha256" -type f -print | xargs cat >> libwallets.txt.sha256-verify | |
cat libwallets.txt.sha256-verify | |
sha256sum -c libwallets.txt.sha256-verify | |
- name: Sync to S3 on tag | |
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
continue-on-error: true # Don't break if s3 upload fails | |
uses: jakejarvis/[email protected] | |
with: | |
args: --acl public-read --follow-symlinks | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: "us-east-1" # optional: defaults to us-east-1 | |
SOURCE_DIR: "$GITHUB_WORKSPACE/libwallets" | |
DEST_DIR: "libwallet" | |
create-release: | |
runs-on: ubuntu-latest | |
needs: libwallet_uploads | |
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
steps: | |
- name: Download binaries | |
uses: actions/download-artifact@v3 | |
with: | |
path: libwallets | |
- name: Update sha256 for top level paths | |
shell: bash | |
working-directory: libwallets | |
run: | | |
ls -alht | |
find . -name "libminotari_wallet_ffi.*.sha256" -type f \ | |
-exec sed -i -e "s/libwallet-.*\///g" '{}' \; | |
ls -alht | |
- name: Archive libwallet-ios-xcframework | |
shell: bash | |
working-directory: libwallets | |
run: | | |
ls -alht | |
if [ -d libwallet-ios-xcframework ]; then | |
7z a libminotari_wallet_ffi.ios-xcframework.zip libwallet-ios-xcframework/* | |
rm -fr libwallet-ios-xcframework/* | |
shasum -a 256 \ | |
"libminotari_wallet_ffi.ios-xcframework.zip" \ | |
> "libminotari_wallet_ffi.ios-xcframework.zip.sha256" | |
fi | |
ls -alht | |
- name: Create release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "libwallet*/**/*" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
prerelease: true | |
draft: true | |
allowUpdates: true | |
updateOnlyUnreleased: true | |
replacesArtifacts: true |