From 7757a2b89a7a38f18d9878f826183de3cf06d789 Mon Sep 17 00:00:00 2001 From: LYJW131 Date: Mon, 13 Jul 2026 09:54:51 +0800 Subject: [PATCH] ci: publish x86_64 wrapper release Co-authored-by: Codex Signed-off-by: LYJW131 --- .github/workflows/build-for-x86_64.yml | 59 ------------- .github/workflows/build.yml | 115 ++++++++++++++----------- .github/workflows/wrapper-qemu.yml | 48 ----------- 3 files changed, 64 insertions(+), 158 deletions(-) delete mode 100644 .github/workflows/build-for-x86_64.yml delete mode 100644 .github/workflows/wrapper-qemu.yml diff --git a/.github/workflows/build-for-x86_64.yml b/.github/workflows/build-for-x86_64.yml deleted file mode 100644 index 67dd2a8..0000000 --- a/.github/workflows/build-for-x86_64.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Build for x86_64 - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -permissions: - contents: write - -jobs: - build: - runs-on: ubuntu-22.04 - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Install LLVM - run: sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" - - - name: Set up Android NDK r23b - run: | - curl -fLO https://dl.google.com/android/repository/android-ndk-r23b-linux.zip - unzip -qd . android-ndk-r23b-linux.zip - - - name: Build - run: | - mkdir build - cd build - cmake .. - make - - - name: Set outputs - id: vars - run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - - - name: Create Release Zip File - run: zip -r Wrapper.x86_64.latest.zip rootfs/ wrapper wrapper-rootless Dockerfile compose.yaml entrypoint.sh - - - name: Update Tag - run: | - git tag -f wrapper.x86_64.latest - git push origin wrapper.x86_64.latest --force - - - name: Create or Update Release - uses: softprops/action-gh-release@v2 - with: - files: Wrapper.x86_64.latest.zip - body: | - Latest build for x86_64. - Commit: ${{ github.sha }} - Message: ${{ github.event.head_commit.message }} - name: Wrapper.x86_64.latest - tag_name: wrapper.x86_64.latest - make_latest: true - overwrite: true \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9a37d66..20ea05d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,61 +1,74 @@ -name: Build +name: Build x86_64 wrapper on: - workflow_dispatch: # 允许手动触发 + workflow_dispatch: push: - branches: [ "main", "lyjw" ] + branches: [main] pull_request: - branches: [ "main" ] + branches: [main] + +permissions: + contents: write + +concurrency: + group: wrapper-x86_64-${{ github.ref }} + cancel-in-progress: true jobs: build: - runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4 - - - name: Install aria2 - run: sudo apt install aria2 -y - - - name: Install LLVM - run: sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" - - - name: Set up Android NDK r23b - run: | - aria2c -o android-ndk-r23b-linux.zip https://dl.google.com/android/repository/android-ndk-r23b-linux.zip - unzip -q -d . android-ndk-r23b-linux.zip - - - name: Build - run: | - mkdir build - cd build - cmake .. - make - - - name: Set outputs - id: vars - run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: Wrapper.x86_64.${{ steps.vars.outputs.sha_short }} - include-hidden-files: true - path: | - rootfs - wrapper - Dockerfile - - - name: Create Release Zip File - run: zip -r Wrapper.x86_64.${{ steps.vars.outputs.sha_short }}.zip rootfs/ wrapper Dockerfile - - - name: Create Release - uses: softprops/action-gh-release@v2 - with: - files: Wrapper.x86_64.${{ steps.vars.outputs.sha_short }}.zip - body: ${{ github.event.head_commit.message }} - name: Wrapper.x86_64.${{ steps.vars.outputs.sha_short }} - tag_name: Wrapper.x86_64.${{ steps.vars.outputs.sha_short }} - make_latest: true - + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install build dependencies + run: | + sudo apt-get update + sudo apt-get install -y aria2 cmake ninja-build + + - name: Download Android NDK r23b + run: | + aria2c -o android-ndk-r23b-linux.zip \ + https://dl.google.com/android/repository/android-ndk-r23b-linux.zip + unzip -q android-ndk-r23b-linux.zip + + - name: Build x86_64 wrapper + run: | + cmake -S . -B build -G Ninja + cmake --build build + + - name: Set artifact metadata + id: vars + run: echo "sha_short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" + + - name: Package x86_64 wrapper + run: | + zip -r Wrapper.x86_64.latest.zip \ + rootfs/ wrapper wrapper-rootless Dockerfile compose.yaml entrypoint.sh + + - name: Upload x86_64 artifact + uses: actions/upload-artifact@v4 + with: + name: Wrapper.x86_64.${{ steps.vars.outputs.sha_short }} + path: Wrapper.x86_64.latest.zip + if-no-files-found: error + + - name: Move latest tag + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + run: | + git tag -f wrapper.x86_64.latest + git push origin wrapper.x86_64.latest --force + + - name: Publish latest x86_64 release + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + uses: softprops/action-gh-release@v2 + with: + tag_name: wrapper.x86_64.latest + name: Wrapper.x86_64.latest + body: | + Latest x86_64 wrapper build. + Commit: ${{ github.sha }} + files: Wrapper.x86_64.latest.zip + make_latest: true diff --git a/.github/workflows/wrapper-qemu.yml b/.github/workflows/wrapper-qemu.yml deleted file mode 100644 index a4d0449..0000000 --- a/.github/workflows/wrapper-qemu.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: wrapper-qemu - -on: - workflow_run: - workflows: ["Build"] - types: [completed] - -jobs: - on-success: - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} - steps: - - uses: actions/checkout@v4 - - - name: Download wrapper-qemu basic image - run: wget https://github.com/WorldObservationLog/wrapper/releases/download/wrapper-qemu/wrapper.qcow2 - - - name: Mount image - run: | - sudo apt-get install -y qemu-utils - sudo modprobe nbd max_part=8 - sudo qemu-nbd --connect=/dev/nbd0 wrapper.qcow2 - sudo mkdir /mnt/wrapper - sudo mount /dev/nbd0p3 /mnt/wrapper/ - - - name: Download latest artifact - uses: dawidd6/action-download-artifact@v6 - with: - github_token: ${{secrets.ACTION_TOKEN}} - run_id: ${{ github.event.workflow_run.id }} - - - name: Copy wrapper to image - run: | - mv Wrapper.x86_64.* wrapper - sudo mv wrapper /mnt/wrapper/root/wrapper - sudo chmod +x /mnt/wrapper/root/wrapper/wrapper - - - name: Unmount image - run: | - sudo umount /mnt/wrapper/ - sudo qemu-nbd --disconnect /dev/nbd0 - - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: wrapper-qemu - path: wrapper.qcow2 -