Skip to content

Library updater for znn_ledger_dart #1

Library updater for znn_ledger_dart

Library updater for znn_ledger_dart #1

name: Library updater for znn_ledger_dart
on:
push:
branches:
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
lib-builder:
runs-on: ubuntu-latest
steps:
- name: Prepare environment
run: |
sudo apt update
sudo apt upgrade -y
sudo apt install -y unzip
- name: Checkout
uses: actions/checkout@v3
- name: Download libledger_ffi
uses: robinraju/release-downloader@v1.6
with:
repository: "hypercore-one/ledger_ffi_rs"
latest: true
- name: Unzip libledger_ffi native library to blobs directory
run: |
unzip -j -o libledger_ffi-darwin-universal.zip -d lib/src/ledger/blobs/
unzip -j -o libledger_ffi-linux-amd64.zip -d lib/src/ledger/blobs/
unzip -j -o libledger_ffi-windows-amd64.zip -d lib/src/ledger/blobs/
- name: Check if there are changes
run: |
function check() {
if [[ -z "$(git status --porcelain)" ]];
then
echo "0"
else
echo "1"
fi
}
echo "CHANGED=$(check)" >> $GITHUB_ENV
- name: Push if changes are present
if: ${{ env.CHANGED == '1' }}
run: |
git config user.name "Github Actions"
git config user.email "GH-actions-ci@github.com"
git fetch
git pull
git add -f lib/src/ledger/blobs/*
git commit -m "Updated native libraries"
git push origin ${GITHUB_REF##*/}