Build Factory and OTA Images #23
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 Factory and OTA Images" | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
name: "build" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Configure Fast APT Mirror | |
uses: vegardit/fast-apt-mirror.sh@v1 | |
with: # the following parameters are listed with their action default values and are optional | |
healthchecks: 20 # Number of mirrors from the mirrors list to check for availability and up-to-dateness | |
speedtests: 10 # Maximum number of healthy mirrors to test for speed | |
parallel: 2 # Number of parallel speed tests | |
sample-size: 1024 # Number of kilobytes to download during the speed from each mirror | |
sample-time: 3 # Maximum number of seconds within the sample download from a mirror must finish | |
- name: Install Dependencies | |
run: | | |
sudo apt update | |
sudo apt -y install curl wget ninja-build | |
sudo apt -y install build-essential libtool | |
sudo apt -y install python3 python3-pip python-is-python3 | |
sudo python -m pip install -U pip | |
sudo pip install wheel click | |
ARCH=$(uname -m) | |
if [ "$ARCH" = "x86_64" ]; then | |
wget -q https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu/12.2.rel1/binrel/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz | |
mkdir gcc-arm-none-eabi-12.2.rel1 | |
tar -xf arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz --strip-components=1 -C gcc-arm-none-eabi-12.2.rel1 | |
else | |
wget -q https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu/12.2.rel1/binrel/arm-gnu-toolchain-12.2.rel1-aarch64-arm-none-eabi.tar.xz | |
mkdir gcc-arm-none-eabi-12.2.rel1 | |
tar -xf arm-gnu-toolchain-12.2.rel1-aarch64-arm-none-eabi.tar.xz --strip-components=1 -C gcc-arm-none-eabi-12.2.rel1 | |
fi | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Populate vars | |
id: vars | |
run: | | |
echo "build_date=$(date +"%Y%m%d")" >> $GITHUB_OUTPUT | |
echo "short_hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
echo "fw_revision=$(sed -n 's/^#define FW_REVISION\s*"\(.*\)"/\1/p' app/firmware_config.h)" >> $GITHUB_OUTPUT | |
echo "artifacts_url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"" >> $GITHUB_OUTPUT | |
- name: Build and Sign | |
env: | |
BT_SIG_PK: ${{ secrets.BT_SIG_PK }} | |
run: | | |
export PATH=$PATH:$PWD/gcc-arm-none-eabi-12.2.rel1/bin | |
./build.sh | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "${{ github.event.repository.name }}-${{ steps.vars.outputs.fw_revision }}-${{ steps.vars.outputs.build_date }}-${{ steps.vars.outputs.short_hash }}" | |
path: | | |
artifacts/* | |
artifacts_signed/* | |
- 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-BT | |
artifact-name: Pro-Hardware-Firmware-BT | |
artifact-bundle-id: "so.onekey.firmware.pro.bt" | |
artifact-version-name: "${{ steps.vars.outputs.fw_revision }}" | |
artifact-version-code: "${{ steps.vars.outputs.short_hash }}" | |
artifact-download-url: "${{ steps.vars.outputs.artifacts_url }}" | |
change-log: "Download [Artifacts] at the bottom of page." | |
custom-issue-url: "" | |
custom-message-title: "" | |
custom-message-payload: "" | |
filter-code: false |