Release Assets Builder #11
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: "Release Assets Builder" | |
on: | |
workflow_dispatch: | |
jobs: | |
build-static: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v4 | |
- name: "Populate vars" | |
run: | | |
FIRMWARE_VERSION=$(cat ./core/embed/firmware/version.h | grep -E '#define ONEKEY_VERSION_(MAJOR|MINOR|PATCH)' | awk '{printf "%s.", $3}' | sed 's/\.$//') | |
BUILD_DATE=$(date +"%Y%m%d") | |
SHORT_HASH=$(git rev-parse --short HEAD) | |
echo "FIRMWARE_VERSION=$FIRMWARE_VERSION" >> $GITHUB_ENV | |
echo "BUILD_DATE=$BUILD_DATE" >> $GITHUB_ENV | |
echo "SHORT_HASH=$SHORT_HASH" >> $GITHUB_ENV | |
echo "ARTIFACTS_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"" >> $GITHUB_ENV | |
- name: "Download base resources" | |
run: | | |
mkdir dist | |
wget -P dist/ https://web.onekey-asset.com/hardware/pro/resource/resource-base-v4.8.0.zip | |
- name: "LFS pull" | |
run: | | |
sudo apt update | |
sudo apt install -y xattr git-lfs | |
git lfs pull | |
- name: "Clean only emulator used resources" | |
run: > | |
pushd core/src/trezor/lvglui/res && | |
rm *-emu.bin; | |
popd | |
- name: "Diff two folders and output the delta to a new folder" | |
run: | | |
mkdir dist/res-4.8.0-${{ env.FIRMWARE_VERSION }} | |
unzip dist/resource-base-v4.8.0.zip -d dist | |
ls core/src/trezor/lvglui/res |xargs -I{} xattr -d com.apple.quarantine core/src/trezor/lvglui/res/{} | |
chmod 666 core/src/trezor/lvglui/res/* | |
diff -qr core/src/trezor/lvglui/res dist/res | grep 'Only in core/src/trezor/lvglui/res' | cut -d ':' -f2 | xargs -I{} cp core/src/trezor/lvglui/res/{} dist/res-4.8.0-${{ env.FIRMWARE_VERSION }} | |
diff -qr core/src/trezor/lvglui/res dist/res | grep 'differ$' | cut -d ' ' -f2 | xargs -I{} cp {} dist/res-4.8.0-${{ env.FIRMWARE_VERSION }} | |
zip -rj dist/res-4.8.0-${{ env.FIRMWARE_VERSION }}.zip dist/res-4.8.0-${{ env.FIRMWARE_VERSION }} | |
zip -rj dist/res-${{ env.FIRMWARE_VERSION }}.zip core/src/trezor/lvglui/res | |
- name: "Upload Artifacts" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Firmware-resource-${{ env.FIRMWARE_VERSION }} | |
path: | | |
dist/res-4.8.0-${{ env.FIRMWARE_VERSION }}.zip | |
dist/res-${{ env.FIRMWARE_VERSION }}.zip | |
- name: "Notify to Slack" | |
uses: onekeyhq/actions/notice-slack-app-update@main | |
with: | |
web-hook-url: ${{ secrets.SLACK_DEV_RELEASE_WEBHOOK }} | |
artifact-type: PRO-FIRMWARE | |
artifact-name: Pro-Static-Resource | |
artifact-bundle-id: "so.onekey.firmware.pro" | |
artifact-version-name: "${{ env.FIRMWARE_VERSION }}" | |
artifact-version-code: "${{ env.SHORT_HASH }}-${{ env.BUILD_DATE }}" | |
artifact-download-url: "${{ env.ARTIFACTS_URL }}" | |
change-log: "" | |
custom-issue-url: "" | |
custom-message-title: "" | |
custom-message-payload: "" |