Skip to content

Daily Update and Build #1

Daily Update and Build

Daily Update and Build #1

Workflow file for this run

name: "Daily Update and Build"
on:
schedule:
# 每天8点UTC时间触发
- cron: '0 8 * * *'
push:
branches:
- dev # 当 dev 分支有更新时也触发
workflow_dispatch: # 允许手动触发工作流
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
DEFAULT_TARGET: f7
FBT_GIT_SUBMODULE_SHALLOW: 1
jobs:
update-and-build:
permissions:
issues: write
pull-requests: write
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [f7]
steps:
# Step 1: Checkout the repository
- name: "Checkout repository"
uses: actions/checkout@v4
with:
fetch-depth: 1
ref: dev # 拉取 dev 分支的代码
# Step 2: Fetch latest upstream changes and apply patch
- name: "Pull latest changes from upstream"
run: |
# 拉取上游仓库
git remote add upstream https://github.com/Next-Flip/Momentum-Firmware.git
git fetch upstream
git checkout dev # 确保当前在 dev 分支
git reset --hard upstream/dev # 重置为上游仓库的最新代码
git pull upstream dev
# 下载并应用汉化补丁
curl -O https://github.com/kalicyh/Momentum-Firmware-CN/raw/CN/%E6%B1%89%E5%8C%96%E8%A1%A5%E4%B8%81/All-in.patch
git apply All-in.patch || exit 1 # 如果补丁应用失败则退出
# Step 3: Build the firmware and apps
- name: "Build the firmware and apps"
id: build-fw
run: |
./fbt TARGET_HW=$TARGET_HW $FBT_BUILD_TYPE updater_package
echo "firmware_api=$(./fbt TARGET_HW=$TARGET_HW get_apiversion)" >> $GITHUB_OUTPUT
# Step 4: Check for uncommitted changes (optional)
- name: "Check for uncommitted changes"
run: |
git diff --exit-code
# Step 5: Upload artifacts to GitHub
- name: "Upload build artifacts to GitHub"
uses: actions/upload-artifact@v3
with:
path: |
dist/${{ env.TARGET }}-*/flipper-z-${{ env.TARGET }}-update-*
dist/${{ env.TARGET }}-*/flipper-z-${{ env.TARGET }}-sdk-*
# Step 6: Release the build artifacts
- name: "Release"
uses: ncipollo/release-action@v1
with:
tag: ${{ github.ref_name }}
draft: false
allowUpdates: true
artifacts: |
dist/${{ env.TARGET }}-*/flipper-z-${{ env.TARGET }}-update-*
dist/${{ env.TARGET }}-*/flipper-z-${{ env.TARGET }}-sdk-*
token: ${{ secrets.TOKEN }}