build-touch #794
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-touch" | |
on: | |
schedule: | |
- cron: '30 19 * * 0,1,2,3,4' | |
workflow_dispatch: | |
jobs: | |
build-touch: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v3 | |
- name: Populate vars | |
id: vars | |
run: | | |
BOOT_VERSION=$(./tools/version.sh ./core/embed/bootloader/version.h) | |
FIRMWARE_VERSION=$(cat ./core/embed/firmware/version.h | grep "ONEKEY_VERSION " | awk -F "[\"\"]" '{print $2}') | |
BUILD_DATE=$(date +"%Y%m%d") | |
SHORT_HASH=$(git rev-parse --short HEAD) | |
echo "BOOT_VERSION=$BOOT_VERSION" >> $GITHUB_ENV | |
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: "Build boardloader bootloader firmware" | |
env: | |
PRODUCTION: 1 | |
run: | | |
sh <(curl -L https://releases.nixos.org/nix/nix-2.23.3/install) --no-daemon | |
. $HOME/.nix-profile/etc/profile.d/nix.sh | |
nix-shell --run "poetry install" | |
git submodule update --init --recursive | |
nix-shell --run "poetry run make -C core build_boardloader" | |
nix-shell --run "poetry run make -C core build_bootloader" | |
nix-shell --run "poetry run make -C core build_firmware" | |
nix-shell --run "poetry run core/tools/headertool.py -h core/build/firmware/touch*Stable*.bin -S 1:${{ secrets.SECRET_KEY_1 }} -S 2:${{ secrets.SECRET_KEY_2 }}" | |
mkdir -p core/build/output/boardloader && mkdir -p core/build/output/bootloader && mkdir -p core/build/output/firmware | |
cp ./core/build/boardloader/boardloader.bin core/build/output/boardloader | |
cp ./core/build/bootloader/bootloader*Stable*.bin core/build/output/bootloader | |
cp ./core/build/firmware/touch*Stable*.bin core/build/output/firmware | |
- name: "Build boardloader bootloader firmware for qa" | |
env: | |
PRODUCTION: 0 | |
run: | | |
sh <(curl -L https://releases.nixos.org/nix/nix-2.23.3/install) --no-daemon | |
. $HOME/.nix-profile/etc/profile.d/nix.sh | |
nix-shell --run "poetry install" | |
git submodule update --init --recursive | |
nix-shell --run "poetry run make -C core clean" | |
nix-shell --run "poetry run make -C core build_boardloader" | |
nix-shell --run "poetry run make -C core build_bootloader" | |
nix-shell --run "poetry run make -C core build_firmware" | |
nix-shell --run "poetry run core/tools/headertool.py -h core/build/firmware/touch*Stable*.bin -S 1:${{ secrets.SECRET_QA_KEY_1 }} -S 2:${{ secrets.SECRET_QA_KEY_2 }}" | |
mkdir -p core/build/output/qa | |
cp ./core/build/boardloader/boardloader.bin ./core/build/bootloader/bootloader*Stable*.bin ./core/build/firmware/touch*Stable*.bin core/build/output/qa | |
cd core/build/output/qa | |
firmware_file=$(basename touch*Stable*.bin) | |
dd if=$firmware_file of=$firmware_file.p1 skip=0 bs=128k count=12 | |
dd if=$firmware_file of=$firmware_file.p2 skip=12 bs=128k | |
- name: "Upload Artifacts" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: firmware-${{ github.sha }} | |
path: | | |
./core/build/output | |
- name: "Notify to Slack" | |
uses: onekeyhq/actions/notice-slack-app-update@main | |
with: | |
web-hook-url: ${{ secrets.SLACK_DEV_RELEASE_WEBHOOK }} | |
artifact-type: TOUCH-FIRMWARE | |
artifact-name: Touch-Hardware-Firmware | |
artifact-bundle-id: 'so.onekey.firmware.touch' | |
artifact-version-name: '${{ env.FIRMWARE_VERSION }}' | |
artifact-version-code: '${{ env.SHORT_HASH }}-${{ env.BUILD_DATE }}' | |
artifact-download-url: '${{ env.ARTIFACTS_URL }}' | |
change-log: 'firmware@${{ env.FIRMWARE_VERSION }} / boot@${{ env.BOOT_VERSION }}' | |
custom-issue-url: '' | |
custom-message-title: '' | |
custom-message-payload: '' |