From 7302653879c0e6d34c1fa3f34163894e8ac5e95c Mon Sep 17 00:00:00 2001 From: weishu Date: Wed, 8 Feb 2023 22:31:43 +0800 Subject: [PATCH] Add release ci (#218) --- .github/scripts/build_a12.sh | 2 +- .github/scripts/build_a13.sh | 2 +- .../workflows/build-WSA-5.10.117-kernel.yml | 1 + .github/workflows/build-kernel-a12.yml | 14 ++++- .github/workflows/build-kernel-a13.yml | 14 ++++- .github/workflows/build-manager.yml | 1 + .github/workflows/release.yml | 55 +++++++++++++++++++ 7 files changed, 83 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/scripts/build_a12.sh b/.github/scripts/build_a12.sh index f60329836af1..23de8bdeeb7f 100644 --- a/.github/scripts/build_a12.sh +++ b/.github/scripts/build_a12.sh @@ -37,7 +37,7 @@ build_from_image() { echo '[+] Compress images' for image in boot*.img; do $GZIP -n -f -9 "$image" - mv "$image".gz ksu-"$VERSION"-"$image".gz + mv "$image".gz ksu-"$VERSION"-"$1"-"$image".gz done echo "[+] Images to upload" diff --git a/.github/scripts/build_a13.sh b/.github/scripts/build_a13.sh index 703fc2f19745..cd029e9526c3 100644 --- a/.github/scripts/build_a13.sh +++ b/.github/scripts/build_a13.sh @@ -24,7 +24,7 @@ build_from_image() { echo '[+] Compress images' for image in boot*.img; do $GZIP -n -f -9 "$image" - mv "$image".gz ksu-"$VERSION"-"$image".gz + mv "$image".gz ksu-"$VERSION"-"$1"-"$image".gz done echo '[+] Images to upload' diff --git a/.github/workflows/build-WSA-5.10.117-kernel.yml b/.github/workflows/build-WSA-5.10.117-kernel.yml index 5a2a62cf8a05..ac19c581807b 100644 --- a/.github/workflows/build-WSA-5.10.117-kernel.yml +++ b/.github/workflows/build-WSA-5.10.117-kernel.yml @@ -9,6 +9,7 @@ on: branches: [ "main" ] paths: - 'kernel/**' + workflow_call: jobs: build: strategy: diff --git a/.github/workflows/build-kernel-a12.yml b/.github/workflows/build-kernel-a12.yml index 7df9fad8600c..f0091ff2d77f 100644 --- a/.github/workflows/build-kernel-a12.yml +++ b/.github/workflows/build-kernel-a12.yml @@ -14,6 +14,7 @@ on: - ".github/workflows/gki-kernel.yml" - ".github/scripts/build-a12.sh" - "kernel/**" + workflow_call: jobs: build-kernel: if: github.event_name != 'pull_request' @@ -41,7 +42,7 @@ jobs: upload-artifacts: needs: build-kernel runs-on: ubuntu-latest - if: ${{ ( github.event_name != 'pull_request' && github.ref == 'refs/heads/main' ) || github.ref_type == 'tag' }} + if: ${{ ( github.event_name != 'pull_request' && github.ref == 'refs/heads/main' ) || github.ref_type == 'tag' || github.ref == 'refs/heads/ci' }} env: CHAT_ID: ${{ secrets.CHAT_ID }} CACHE_CHAT_ID: ${{ secrets.CACHE_CHAT_ID }} @@ -91,11 +92,20 @@ jobs: export MKBOOTIMG=$GITHUB_WORKSPACE/mkbootimg/mkbootimg.py export UNPACK_BOOTIMG=$GITHUB_WORKSPACE/mkbootimg/unpack_bootimg.py cd $GITHUB_WORKSPACE/KernelSU - export VERSION=$(git rev-list --count HEAD) + export VERSION=$(($(git rev-list --count HEAD) + 10200)) echo "VERSION: $VERSION" cd - bash $GITHUB_WORKSPACE/KernelSU/.github/scripts/build_a12.sh + - name: Display structure of boot files + run: ls -R + + - name: Upload images artifact + uses: actions/upload-artifact@v3 + with: + name: boot-images-android12 + path: Image-android12*/*.img.gz + check-build-kernel: if: github.event_name == 'pull_request' uses: ./.github/workflows/gki-kernel.yml diff --git a/.github/workflows/build-kernel-a13.yml b/.github/workflows/build-kernel-a13.yml index b4d860aaa3b1..b5659e0c3831 100644 --- a/.github/workflows/build-kernel-a13.yml +++ b/.github/workflows/build-kernel-a13.yml @@ -14,6 +14,7 @@ on: - ".github/workflows/gki-kernel.yml" - ".github/scripts/build-a13.sh" - "kernel/**" + workflow_call: jobs: build-kernel: if: github.event_name != 'pull_request' @@ -42,7 +43,7 @@ jobs: upload-artifacts: needs: build-kernel runs-on: ubuntu-latest - if: ${{ ( github.event_name != 'pull_request' && github.ref == 'refs/heads/main' ) || github.ref_type == 'tag' }} + if: ${{ ( github.event_name != 'pull_request' && github.ref == 'refs/heads/main' ) || github.ref_type == 'tag' || github.ref == 'refs/heads/ci' }} env: CHAT_ID: ${{ secrets.CHAT_ID }} CACHE_CHAT_ID: ${{ secrets.CACHE_CHAT_ID }} @@ -92,10 +93,19 @@ jobs: export MKBOOTIMG=$GITHUB_WORKSPACE/mkbootimg/mkbootimg.py export UNPACK_BOOTIMG=$GITHUB_WORKSPACE/mkbootimg/unpack_bootimg.py cd $GITHUB_WORKSPACE/KernelSU - export VERSION=$(git rev-list --count HEAD) + export VERSION=$(($(git rev-list --count HEAD) + 10200)) echo "VERSION: $VERSION" cd - bash $GITHUB_WORKSPACE/KernelSU/.github/scripts/build_a13.sh + + - name: Display structure of boot files + run: ls -R + + - name: Upload images artifact + uses: actions/upload-artifact@v3 + with: + name: boot-images-android13 + path: Image-android13*/*.img.gz check-build-kernel: if: github.event_name == 'pull_request' diff --git a/.github/workflows/build-manager.yml b/.github/workflows/build-manager.yml index cc362416653b..111d9f24dd65 100644 --- a/.github/workflows/build-manager.yml +++ b/.github/workflows/build-manager.yml @@ -10,6 +10,7 @@ on: branches: [ "main" ] paths: - 'manager/**' + workflow_call: jobs: build-ksud: strategy: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000000..eacdd72f920a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,55 @@ +name: Release +on: + push: + tags: + - "v*" + workflow_dispatch: + +jobs: + build-manager: + uses: ./.github/workflows/build-manager.yml + build-a12-kernel: + uses: ./.github/workflows/build-kernel-a12.yml + build-a13-kernel: + uses: ./.github/workflows/build-kernel-a13.yml + build-wsa-kernel: + uses: ./.github/workflows/build-WSA-5.10.117-kernel.yml + release: + needs: + - build-manager + - build-a12-kernel + - build-a13-kernel + - build-wsa-kernel + runs-on: ubuntu-latest + steps: + - name: Download artifacts + uses: actions/download-artifact@v3 + - name: Zip AnyKernel3 + run: | + for dir in AnyKernel3-*; do + if [ -d "$dir" ]; then + echo "----- Zip $dir -----" + (cd $dir && zip -r9 "$dir".zip ./* -x .git .gitignore ./*.zip && mv *.zip ..) + fi + done + + - name: Zip WSA kernel + run: | + for dir in kernel-WSA-*; do + if [ -d "$dir" ]; then + echo "------ Zip $dir ----------" + (cd $dir && zip -r9 "$dir".zip ./* -x .git .gitignore ./*.zip && mv *.zip ..) + fi + done + + - name: Display structure of downloaded files + run: ls -R + + - name: release + uses: softprops/action-gh-release@v1 + with: + files: | + manager/*.apk + AnyKernel3-*.zip + boot-images-*/Image-*/*.img.gz + kernel-WSA*.zip