diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7d04014..014c181 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,16 +11,24 @@ jobs: name: Set matrix runs-on: ubuntu-latest outputs: - sdks: ${{ steps.find_targets.outputs.sdks }} + sdks: ${{ steps.out.outputs.sdks }} + strategy: + matrix: + ref: + - main # apk + - openwrt-23.05 # ipk steps: - name: Checkout uses: actions/checkout@v4 with: repository: openwrt/openwrt + ref: ${{ matrix.ref }} - name: Set targets id: find_targets run: | + REF=${{ matrix.ref }} + # sdks JSON='[' FIRST=1 @@ -32,7 +40,7 @@ jobs: [[ $FIRST -ne 1 ]] && JSON="$JSON"',' FIRST=0 - JSON="$JSON"'{"arch":"'"$ARCH"'"}' + JSON="$JSON"'{"arch":"'"$ARCH"'","ref":"'"$REF"'"}' done <<< $(perl ./scripts/dump-target-info.pl architectures 2>/dev/null) JSON="$JSON"']' @@ -41,40 +49,63 @@ jobs: echo -e "\n---- sdks ----\n" echo "sdks=$JSON" >> "$GITHUB_OUTPUT" - build: - name: Build for ${{ matrix.arch }} + - uses: cloudposse/github-action-matrix-outputs-write@main + id: out + with: + matrix-step-name: ${{ github.job }} + matrix-key: ${{ matrix.ref }} + outputs: |- + sdks: ${{ steps.find_targets.outputs.sdks }} + + gather_matrix: + name: Gather build matrices runs-on: ubuntu-latest needs: generate_matrix + outputs: + result: ${{ steps.gather.outputs.result }} + steps: + - uses: cloudposse/github-action-matrix-outputs-read@main + id: read + with: + matrix-step-name: generate_matrix + - name: Gather matrices + id: gather + run: | + result=$(jq -c '.sdks[]' <<< '${{ steps.read.outputs.result }}' | jq -c -s add) + echo "result=${result}" >> $GITHUB_OUTPUT + + build: + name: Build for ${{ matrix.arch }}-${{ matrix.ref }} + runs-on: ubuntu-latest + needs: gather_matrix strategy: fail-fast: false matrix: - include: ${{ fromJson(needs.generate_matrix.outputs.sdks) }} + include: ${{ fromJson(needs.gather_matrix.outputs.result) }} steps: - name: Checkout uses: actions/checkout@v4 - - name: Fetch upstream git reversion - id: op_version - run: echo sha=$(cat .nvchecker/sha) >> $GITHUB_OUTPUT + - name: Fetch Cloudflared makefile + run: | + sha=$(cat .nvchecker/sha) + curl "https://codeload.github.com/openwrt/packages/tar.gz/$sha" | \ + tar -xz --strip=2 "packages-$sha/net/cloudflared" + sed -i 's#\.\./\.\.#$(TOPDIR)/feeds/packages#' cloudflared/Makefile - name: Build Package uses: openwrt/gh-action-sdk@main env: - ARCH: ${{ matrix.arch }}-main + ARCH: ${{ matrix.arch }}-${{ matrix.ref }} V: s IGNORE_ERRORS: n m y - NO_DEFAULT_FEEDS: 1 - EXTRA_FEEDS: >- - src-git-full|base|https://github.com/openwrt/openwrt.git - src-git|packages|https://github.com/openwrt/packages.git^${{ steps.op_version.outputs.sha }} - PACKAGES: cloudflared - name: Upload Output Folder uses: actions/upload-artifact@v4 with: - name: cloudflared-${{ matrix.arch }} - path: bin/packages/${{ matrix.arch }}/packages/cloudflared_*.ipk + name: cloudflared-${{ matrix.arch }}-${{ matrix.ref }} + path: bin/packages/${{ matrix.arch }}/action/cloudflared* release: if: startsWith(github.ref, 'refs/tags/') @@ -91,4 +122,6 @@ jobs: - name: Release uses: softprops/action-gh-release@v2 with: - files: "*.ipk" + files: | + "*.apk" + "*.ipk" diff --git a/.gitignore b/.gitignore index 123feb2..46c9463 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *~ /.nvchecker/config.toml /.nvchecker/new_ver.json +/cloudflared/