From f3411b658b10703edbf234d214c8e00fc7238064 Mon Sep 17 00:00:00 2001 From: fujr Date: Wed, 9 Apr 2025 14:51:52 +0800 Subject: [PATCH] update workflow --- .github/workflows/main.yml | 86 ++++++++++------------ .github/workflows/{x64.env => x64_apk.env} | 1 + .github/workflows/x64_ipk.env | 4 + 3 files changed, 44 insertions(+), 47 deletions(-) rename .github/workflows/{x64.env => x64_apk.env} (89%) create mode 100644 .github/workflows/x64_ipk.env diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0b40ff7..9a82212 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,45 +2,49 @@ name: "Auto compile with OpenWrt SDK" on: workflow_dispatch: push: - paths: - - 'qmodem/luci/luci-app-qmodem/Makefile' + tags: + - 'v*' + branches: + - main env: TZ: Asia/Shanghai jobs: job_prepare: - name: Prepare runs-on: ubuntu-latest outputs: - git_tag: ${{ steps.set_git_tag.outputs.git_tag }} - is_latest: ${{ steps.cache-version.outputs.cache-hit }} - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - path: 'qmodem' + branch_name: ${{ env.branch_name }} + tag_name: ${{ env.tag_name }} + push_type: ${{ env.push_type }} + tag_message: ${{ env.tag_message }} + + steps: + - name: Determine push type + run: | + if [[ "${{ github.ref }}" == refs/tags/* ]]; then + echo "This is a tag push." + echo "tag_name=${{ github.ref_name }}" >> $GITHUB_ENV + echo "push_type=tag" >> $GITHUB_ENV + else + echo "This is a branch push." + echo "branch_name=${{ github.ref_name }}" >> $GITHUB_ENV + echo "push_type=branch" >> $GITHUB_ENV + fi + + - name: Checkout + if: + uses: actions/checkout@v2 + with: + path: 'qmodem' + + - name: Get tag info + id: get_tag_info + run: | + cd qmodem + TAG_MESSAGE=$(git for-each-ref refs/tags/${{ env.tag_name }} --format='%(contents)') + echo "tag_message=${TAG_MESSAGE}" >> $GITHUB_ENV - - name: Set git tag - id: set_git_tag - run: | - pkg_version=$(grep -oP '^PKG_VERSION:=\K.*' qmodem/luci/luci-app-qmodem/Makefile) - if [ -z "$pkg_version" ]; then - echo "PKG_VERSION not found in Makefile" - exit 1 - fi - echo "Extracted PKG_VERSION: $pkg_version" - tag="v$pkg_version" - echo "git_tag=$tag" >> $GITHUB_OUTPUT - echo "git_tag=$tag" - echo "git_tag=$tag" >> cache-version - - - name: Cache Version - id: cache-version - uses: actions/cache@v3 - with: - path: cache-version - key: qmodem-version job_build_qmodem: name: Build QModem @@ -48,7 +52,7 @@ jobs: continue-on-error: true strategy: matrix: - build_arch: ['arm64_ipk',"arm64_apk"] + build_arch: ['arm64_ipk',"arm64_apk","x64_apk","x64_ipk" ] runs-on: ubuntu-latest steps: - name: Install packages @@ -156,23 +160,11 @@ jobs: fi done - - name: Check Release type - run: | - if [[ "${GITHUB_REF}" == *"-beta" ]]; then - echo "Release type: beta" - echo "RELEASE_TYPE=beta" >> $GITHUB_ENV - elif [[ "${GITHUB_REF}" == *"-rc" ]]; then - echo "Release type: rc" - echo "RELEASE_TYPE=rc" >> $GITHUB_ENV - else - echo "Release type: release" - echo "RELEASE_TYPE=release" >> $GITHUB_ENV - fi - - name: Create GitHub Release uses: softprops/action-gh-release@v2 - if: ${{ needs.job_prepare.outputs.is_latest == 'true' }} + if: ${{ needs.job_prepare.outputs.push_type == 'tag' }} with: - tag_name: ${{ needs.job_prepare.outputs.git_tag }} - prerelease: false + body: ${{ needs.job_prepare.outputs.tag_message }} + tag_name: ${{ needs.job_prepare.outputs.tag_name }} + prerelease: ${{ needs.job_prepare.outputs.tag_name == '*-beta' || needs.job_prepare.outputs.tag_name == '*-rc' }} files: releases/* diff --git a/.github/workflows/x64.env b/.github/workflows/x64_apk.env similarity index 89% rename from .github/workflows/x64.env rename to .github/workflows/x64_apk.env index f62b00c..39870c4 100644 --- a/.github/workflows/x64.env +++ b/.github/workflows/x64_apk.env @@ -1,3 +1,4 @@ SDK_NAME=openwrt-sdk-x86-64_gcc-13.3.0_musl.Linux-x86_64 SDK_URL=https://downloads.openwrt.org/snapshots/targets/x86/64/ SDK_ARCH=x86_64 +SDK_EXT=tar.zst diff --git a/.github/workflows/x64_ipk.env b/.github/workflows/x64_ipk.env new file mode 100644 index 0000000..a70c818 --- /dev/null +++ b/.github/workflows/x64_ipk.env @@ -0,0 +1,4 @@ +SDK_NAME=openwrt-sdk-23.05.5-x86-64_gcc-12.3.0_musl.Linux-x86_64 +SDK_URL=https://downloads.openwrt.org/releases/23.05.5/targets/x86/64/ +SDK_ARCH=x86_64 +SDK_EXT=tar.xz