From c659689bc0052a5acdf0e5c80286e8bcb1d43302 Mon Sep 17 00:00:00 2001 From: 苏向夜 Date: Sun, 18 Jan 2026 16:17:50 +0800 Subject: chore(ci): setup semifold --- .github/workflows/release.yml | 174 --------------------------------- .github/workflows/semifold-ci.yaml | 151 ++++++++++++++++++++++++++++ .github/workflows/semifold-status.yaml | 26 +++++ 3 files changed, 177 insertions(+), 174 deletions(-) delete mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/semifold-ci.yaml create mode 100644 .github/workflows/semifold-status.yaml (limited to '.github/workflows') diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 82399e5..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,174 +0,0 @@ -name: Release - -on: - push: - tags: - - "v*" - workflow_dispatch: - inputs: - tag_name: - description: "Tag name to release (e.g., v1.0.0)" - required: true - default: "v1.0.0" - -env: - CARGO_TERM_COLOR: always - -permissions: - contents: write - -jobs: - promote-release: - name: Create Release & Changelog - permissions: - contents: write - runs-on: ubuntu-latest - outputs: - release_id: ${{ steps.create_release.outputs.id }} - release_body: ${{ steps.changelog.outputs.changes }} - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Generate CHANGELOG - id: changelog - uses: requarks/changelog-action@v1 - with: - token: ${{ github.token }} - tag: ${{ github.event_name == 'workflow_dispatch' && inputs.tag_name || github.ref_name }} - changelogFilePath: CHANGELOG.md - includeInvalidCommits: true - useGitmojis: false - - - name: Create Release - id: create_release - uses: softprops/action-gh-release@v1 - with: - tag_name: ${{ github.event_name == 'workflow_dispatch' && inputs.tag_name || github.ref_name }} - name: "DropOut ${{ github.event_name == 'workflow_dispatch' && inputs.tag_name || github.ref_name }}" - body: ${{ steps.changelog.outputs.changes }} - draft: true - prerelease: false - - build-tauri: - name: Build & Upload (${{ matrix.name }}) - needs: promote-release - permissions: - contents: write - strategy: - fail-fast: false - matrix: - include: - - platform: "ubuntu-22.04" - name: "Linux x86_64" - target: "x86_64-unknown-linux-gnu" - args: "--target x86_64-unknown-linux-gnu" - - platform: "ubuntu-24.04-arm" - name: "Linux ARM64" - target: "aarch64-unknown-linux-gnu" - args: "--target aarch64-unknown-linux-gnu" - - platform: "macos-latest" - name: "macOS ARM64" - target: "aarch64-apple-darwin" - args: "--target aarch64-apple-darwin" - - platform: "windows-latest" - name: "Windows x86_64" - target: "x86_64-pc-windows-msvc" - args: "--target x86_64-pc-windows-msvc" - - platform: "windows-11-arm" - name: "Windows ARM64" - target: "aarch64-pc-windows-msvc" - args: "--target aarch64-pc-windows-msvc" - - runs-on: ${{ matrix.platform }} - container: - image: ${{ matrix.container }} - options: --user root - steps: - - uses: actions/checkout@v4 - - - name: Install Dependencies (Linux x86_64) - if: matrix.platform == 'ubuntu-22.04' - run: | - sudo apt-get update - sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential curl wget file libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev libfuse2 - - - name: Install Dependencies (Linux ARM64) - if: matrix.platform == 'ubuntu-24.04-arm' - run: | - sudo apt-get update - sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential curl wget file libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev libfuse2 - - - name: Install pnpm - uses: pnpm/action-setup@v4 - with: - version: 9 - - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: "pnpm" - cache-dependency-path: "ui/pnpm-lock.yaml" - - - name: Install Frontend Dependencies - run: pnpm install - working-directory: ui - - - name: Install Rust - uses: dtolnay/rust-toolchain@stable - with: - targets: ${{ matrix.target }} - - - name: Rust Cache - uses: swatinem/rust-cache@v2 - with: - workspaces: "./src-tauri -> target" - shared-key: ${{ matrix.target }} - - - name: Setup appimagetool (Linux) - if: startsWith(matrix.platform, 'ubuntu') && !startsWith(matrix.platform, 'macos') && !startsWith(matrix.platform, 'windows') - run: | - ARCH=$(uname -m) - wget -q "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-${ARCH}.AppImage" - chmod +x "appimagetool-${ARCH}.AppImage" - if command -v sudo >/dev/null 2>&1; then - sudo mv "appimagetool-${ARCH}.AppImage" /usr/local/bin/appimagetool - else - mv "appimagetool-${ARCH}.AppImage" /usr/local/bin/appimagetool - fi - - - name: Build Tauri App - uses: tauri-apps/tauri-action@v0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - releaseId: ${{ needs.promote-release.outputs.release_id }} - args: ${{ matrix.args }} - - - name: Fix AppImage for Wayland (Linux) - if: startsWith(matrix.platform, 'ubuntu') && !startsWith(matrix.platform, 'macos') && !startsWith(matrix.platform, 'windows') - run: | - # Locate the generated AppImage - APPIMAGE=$(find bundle -name "*.AppImage" -type f | head -1) - echo "Found AppImage: $APPIMAGE" - - if [ -n "$APPIMAGE" ]; then - # backup original AppImage - cp "$APPIMAGE" "${APPIMAGE}.backup" - - # extract AppImage - "$APPIMAGE" --appimage-extract - - # Fix GTK hook, remove forced X11 - if [ -f squashfs-root/apprun-hooks/linuxdeploy-plugin-gtk.sh ]; then - sed -i 's/^export GDK_BACKEND=x11.*$/# export GDK_BACKEND=x11 # Disabled for Wayland compatibility/' squashfs-root/apprun-hooks/linuxdeploy-plugin-gtk.sh - echo "Successfully patched GTK hook for Wayland compatibility" - fi - - # Repack AppImage - appimagetool squashfs-root "$APPIMAGE" - rm -rf squashfs-root - fi - working-directory: src-tauri/target/release diff --git a/.github/workflows/semifold-ci.yaml b/.github/workflows/semifold-ci.yaml new file mode 100644 index 0000000..ad84bbb --- /dev/null +++ b/.github/workflows/semifold-ci.yaml @@ -0,0 +1,151 @@ +name: Semifold CI +on: + push: + branches: [main] + +env: + CLICOLOR_FORCE: 1 + +permissions: + id-token: write + contents: write + pull-requests: write + +jobs: + build-tauri: + name: Build on ${{ matrix.name }} + strategy: + fail-fast: false + matrix: + include: + - platform: "ubuntu-22.04" + name: "Linux x86_64" + target: "x86_64-unknown-linux-gnu" + args: "--target x86_64-unknown-linux-gnu" + - platform: "ubuntu-24.04-arm" + name: "Linux ARM64" + target: "aarch64-unknown-linux-gnu" + args: "--target aarch64-unknown-linux-gnu" + - platform: "macos-latest" + name: "macOS ARM64" + target: "aarch64-apple-darwin" + args: "--target aarch64-apple-darwin" + - platform: "windows-latest" + name: "Windows x86_64" + target: "x86_64-pc-windows-msvc" + args: "--target x86_64-pc-windows-msvc" + - platform: "windows-11-arm" + name: "Windows ARM64" + target: "aarch64-pc-windows-msvc" + args: "--target aarch64-pc-windows-msvc" + + runs-on: ${{ matrix.platform }} + container: + image: ${{ matrix.container }} + options: --user root + steps: + - uses: actions/checkout@v6 + + - name: Install Dependencies (Linux x86_64) + if: matrix.platform == 'ubuntu-22.04' + run: | + sudo apt-get update + sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential curl wget file libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev libfuse2 + + - name: Install Dependencies (Linux ARM64) + if: matrix.platform == 'ubuntu-24.04-arm' + run: | + sudo apt-get update + sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential curl wget file libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev libfuse2 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: latest + + - name: Install Node.js + uses: actions/setup-node@v6 + with: + node-version: 22 + cache: "pnpm" + cache-dependency-path: "ui/pnpm-lock.yaml" + + - name: Install Frontend Dependencies + run: pnpm install + working-directory: ui + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} + + - name: Rust Cache + uses: swatinem/rust-cache@v2 + with: + workspaces: "./src-tauri -> target" + shared-key: ${{ matrix.target }} + + - name: Setup appimagetool (Linux) + if: startsWith(matrix.platform, 'ubuntu') && !startsWith(matrix.platform, 'macos') && !startsWith(matrix.platform, 'windows') + run: | + ARCH=$(uname -m) + wget -q "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-${ARCH}.AppImage" + chmod +x "appimagetool-${ARCH}.AppImage" + if command -v sudo >/dev/null 2>&1; then + sudo mv "appimagetool-${ARCH}.AppImage" /usr/local/bin/appimagetool + else + mv "appimagetool-${ARCH}.AppImage" /usr/local/bin/appimagetool + fi + + - name: Build Tauri App + uses: tauri-apps/tauri-action@v0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + args: ${{ matrix.args }} + + - name: Fix AppImage for Wayland (Linux) + if: startsWith(matrix.platform, 'ubuntu') && !startsWith(matrix.platform, 'macos') && !startsWith(matrix.platform, 'windows') + run: | + # Locate the generated AppImage + APPIMAGE=$(find bundle -name "*.AppImage" -type f | head -1) + echo "Found AppImage: $APPIMAGE" + + if [ -n "$APPIMAGE" ]; then + # backup original AppImage + cp "$APPIMAGE" "${APPIMAGE}.backup" + + # extract AppImage + "$APPIMAGE" --appimage-extract + + # Fix GTK hook, remove forced X11 + if [ -f squashfs-root/apprun-hooks/linuxdeploy-plugin-gtk.sh ]; then + sed -i 's/^export GDK_BACKEND=x11.*$/# export GDK_BACKEND=x11 # Disabled for Wayland compatibility/' squashfs-root/apprun-hooks/linuxdeploy-plugin-gtk.sh + echo "Successfully patched GTK hook for Wayland compatibility" + fi + + # Repack AppImage + appimagetool squashfs-root "$APPIMAGE" + rm -rf squashfs-root + fi + working-directory: src-tauri/target/release + + - name: List Files + run: ls -l src-tauri/target/release + + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + fetch-depth: 0 + - name: Setup Semifold + uses: noctisynth/setup-semifold@main + - name: Semifold CI + run: semifold ci + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} diff --git a/.github/workflows/semifold-status.yaml b/.github/workflows/semifold-status.yaml new file mode 100644 index 0000000..70225f6 --- /dev/null +++ b/.github/workflows/semifold-status.yaml @@ -0,0 +1,26 @@ +name: Semifold Status +on: + pull_request: + branches: [main] + +env: + CLICOLOR_FORCE: 1 + +permissions: + contents: write + pull-requests: write + issues: write + +jobs: + status: + name: Status + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Setup Semifold + uses: noctisynth/setup-semifold@main + - name: Semifold Status + run: semifold status + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -- cgit v1.2.3-70-g09d2