feat(webui): 设备面板支持长按 3 秒后拖拽排序 #25 #57
Workflow file for this run
This file contains hidden or 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: TianShanOS Build | |
| on: | |
| push: | |
| branches: [main, develop] | |
| tags: | |
| - 'v*' # 版本标签触发 | |
| paths-ignore: | |
| - '**.md' | |
| - 'docs/**' | |
| - '.github/copilot-instructions.md' | |
| pull_request: | |
| branches: [main, develop] | |
| paths-ignore: | |
| - '**.md' | |
| - 'docs/**' | |
| workflow_dispatch: # 允许手动触发 | |
| env: | |
| IDF_VERSION: v5.5 | |
| TARGET: esp32s3 | |
| jobs: | |
| build: | |
| name: Build ESP32-S3 Firmware | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # 完整历史用于版本号生成 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Cache ESP-IDF | |
| uses: actions/cache@v4 | |
| id: cache-idf | |
| with: | |
| path: | | |
| ~/esp/esp-idf | |
| ~/.espressif | |
| key: esp-idf-${{ env.IDF_VERSION }}-${{ runner.os }} | |
| restore-keys: | | |
| esp-idf-${{ env.IDF_VERSION }}- | |
| - name: Install ESP-IDF | |
| if: steps.cache-idf.outputs.cache-hit != 'true' | |
| run: | | |
| mkdir -p ~/esp | |
| cd ~/esp | |
| git clone -b ${{ env.IDF_VERSION }} --depth 1 --recursive https://github.com/espressif/esp-idf.git | |
| cd esp-idf | |
| ./install.sh ${{ env.TARGET }} | |
| - name: Setup ESP-IDF environment | |
| run: | | |
| source ~/esp/esp-idf/export.sh | |
| echo "IDF_PATH=$IDF_PATH" >> $GITHUB_ENV | |
| echo "$IDF_PATH/tools" >> $GITHUB_PATH | |
| - name: Cache build directory | |
| uses: actions/cache@v4 | |
| with: | |
| path: build | |
| key: build-${{ env.TARGET }}-${{ hashFiles('**/CMakeLists.txt', '**/Kconfig*', 'sdkconfig.defaults') }} | |
| restore-keys: | | |
| build-${{ env.TARGET }}- | |
| - name: Set target | |
| run: | | |
| source ~/esp/esp-idf/export.sh | |
| idf.py set-target ${{ env.TARGET }} | |
| - name: Build firmware | |
| run: | | |
| source ~/esp/esp-idf/export.sh | |
| # 使用 --fresh 确保版本号更新 | |
| rm -f build/CMakeCache.txt | |
| idf.py build | |
| - name: Get version info | |
| id: version | |
| run: | | |
| if [ -f build/project_description.json ]; then | |
| VERSION=$(grep -o '"project_version":[^,]*' build/project_description.json | cut -d'"' -f4) | |
| fi | |
| echo "version=${VERSION:-0.0.0}" >> $GITHUB_OUTPUT | |
| echo "📦 Build version: ${VERSION:-0.0.0}" | |
| - name: Print build size | |
| run: | | |
| source ~/esp/esp-idf/export.sh | |
| idf.py size | |
| - name: Upload firmware artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: tianshanos-firmware-${{ steps.version.outputs.version || github.sha }} | |
| path: | | |
| build/*.bin | |
| build/bootloader/bootloader.bin | |
| build/partition_table/partition-table.bin | |
| build/flasher_args.json | |
| retention-days: 30 | |
| - name: Upload full build (for debugging) | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-debug-${{ github.sha }} | |
| path: | | |
| build/compile_commands.json | |
| build/project_description.json | |
| build/config/sdkconfig.h | |
| retention-days: 7 | |
| # 编译成功后自动创建 Release:tag 推送 或 main 分支推送 | |
| release: | |
| name: Create Release | |
| needs: build | |
| if: startsWith(github.ref, 'refs/tags/v') || (github.ref == 'refs/heads/main' && github.event_name == 'push') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # 创建 Release 需要写权限 | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: tianshanos-firmware-* | |
| path: firmware | |
| - name: Check if release already exists (main branch) | |
| if: github.ref == 'refs/heads/main' | |
| id: check | |
| run: | | |
| TAG="v${{ needs.build.outputs.version }}" | |
| if gh release view "$TAG" 2>/dev/null; then | |
| echo "skip=true" >> $GITHUB_OUTPUT | |
| echo "⏭️ Release $TAG already exists, skipping" | |
| else | |
| echo "skip=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create Release | |
| if: startsWith(github.ref, 'refs/tags/') || (github.ref == 'refs/heads/main' && steps.check.outputs.skip != 'true') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || format('v{0}', needs.build.outputs.version) }} | |
| name: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || format('v{0}', needs.build.outputs.version) }} | |
| files: firmware/**/*.bin | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |