From 4f9ab69b37f1ed5dfe8dace57ca05499f287094f Mon Sep 17 00:00:00 2001 From: spvkgn Date: Thu, 8 Aug 2024 19:53:42 +0500 Subject: [PATCH 1/2] OpenWrt workflow --- .editorconfig | 4 + .github/workflows/build-openwrt.yml | 116 ++++++++++++++++++++++++++++ .gitignore | 2 + 3 files changed, 122 insertions(+) create mode 100644 .github/workflows/build-openwrt.yml diff --git a/.editorconfig b/.editorconfig index 8126eab..8df5edd 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,3 +4,7 @@ root = true indent_style = tab indent_size = 8 tab_width = 8 + +[*.yml] +indent_style = space +indent_size = 2 diff --git a/.github/workflows/build-openwrt.yml b/.github/workflows/build-openwrt.yml new file mode 100644 index 0000000..2229ed4 --- /dev/null +++ b/.github/workflows/build-openwrt.yml @@ -0,0 +1,116 @@ +name: build-openwrt + +on: + push: + # tags: + # - 'v*' + +jobs: + build: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.build.outputs.version }} + strategy: + matrix: + branch: [openwrt-23.05] + arch: + - aarch64_cortex-a53 + - aarch64_cortex-a72 + - aarch64_generic + - arm_arm1176jzf-s_vfp + - arm_arm926ej-s + - arm_cortex-a15_neon-vfpv4 + - arm_cortex-a5_vfpv4 + - arm_cortex-a7 + - arm_cortex-a7_neon-vfpv4 + - arm_cortex-a7_vfpv4 + - arm_cortex-a8_vfpv3 + - arm_cortex-a9 + - arm_cortex-a9_neon + - arm_cortex-a9_vfpv3-d16 + - arm_fa526 + - arm_mpcore + - arm_xscale + - mips64_octeonplus + - mips_24kc + - mips_4kec + - mips_mips32 + - mipsel_24kc + - mipsel_24kc_24kf + - mipsel_74kc + - mipsel_mips32 + - x86_64 + container: + image: openwrt/sdk:${{ matrix.arch }}-${{ matrix.branch }} + options: --user root + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: 'openwrt' + + - name: Build packages + id: build + working-directory: /builder + env: + ARCH: ${{ matrix.arch }} + BRANCH: ${{ matrix.branch }} + shell: bash + run: | + cp -va $GITHUB_WORKSPACE/youtubeUnblock package + VERSION=$(grep -Po 'PKG_VERSION:=\K.*' package/youtubeUnblock/Makefile) + echo "version=$VERSION" >> $GITHUB_OUTPUT + sed -e 's|base.*\.git|base https://github.com/openwrt/openwrt.git|' \ + -e 's|packages.*\.git|packages https://github.com/openwrt/packages.git|' -i feeds.conf.default + ./scripts/feeds update base packages + ./scripts/feeds install -a + make defconfig + make package/youtubeUnblock/compile V=s -j$(nproc) BUILD_LOG=1 + + - name: Compress build logs + if: always() + env: + ARCH: ${{ matrix.arch }} + BRANCH: ${{ matrix.branch }} + run: | + tar -cJvf logs-$BRANCH-$ARCH.tar.xz /builder/logs + + - name: Upload packages + if: steps.build.outcome == 'success' + uses: actions/upload-artifact@v4 + with: + name: ipk-${{ matrix.branch }}-${{ matrix.arch }} + path: /builder/**/youtubeUnblock*.ipk + if-no-files-found: error + + - name: Upload build logs + if: always() + uses: actions/upload-artifact@v4 + with: + name: logs-${{ matrix.branch }}-${{ matrix.arch }} + path: ./**/logs-${{ matrix.branch }}-${{ matrix.arch }}.tar.xz + + release: + needs: build + permissions: + contents: write + runs-on: ubuntu-latest + strategy: + matrix: + branch: ['23.05'] + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + pattern: ipk-* + + - name: Upload release assets + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + prerelease: false + tag: v${{ needs.build.outputs.version }}-owrt${{ matrix.branch }} + name: v${{ needs.build.outputs.version }} for OpenWrt ${{ matrix.branch }} + body: | + youtubeUnblock v${{ needs.build.outputs.version }} for OpenWrt ${{ matrix.branch }} + artifacts: ./**/*.ipk diff --git a/.gitignore b/.gitignore index f865d01..82104c4 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,5 @@ modules.order Module.symvers *.so *.ko + +!/.github From 7b9e7b773b08c9c77ea1f7d5a607d4af6e5696c3 Mon Sep 17 00:00:00 2001 From: spvkgn Date: Fri, 9 Aug 2024 20:22:20 +0500 Subject: [PATCH 2/2] remove release job --- .github/workflows/build-openwrt.yml | 43 ++++------------------------- 1 file changed, 5 insertions(+), 38 deletions(-) diff --git a/.github/workflows/build-openwrt.yml b/.github/workflows/build-openwrt.yml index 2229ed4..a18b4cf 100644 --- a/.github/workflows/build-openwrt.yml +++ b/.github/workflows/build-openwrt.yml @@ -1,9 +1,7 @@ name: build-openwrt on: - push: - # tags: - # - 'v*' + workflow_dispatch: jobs: build: @@ -52,9 +50,6 @@ jobs: - name: Build packages id: build working-directory: /builder - env: - ARCH: ${{ matrix.arch }} - BRANCH: ${{ matrix.branch }} shell: bash run: | cp -va $GITHUB_WORKSPACE/youtubeUnblock package @@ -62,8 +57,6 @@ jobs: echo "version=$VERSION" >> $GITHUB_OUTPUT sed -e 's|base.*\.git|base https://github.com/openwrt/openwrt.git|' \ -e 's|packages.*\.git|packages https://github.com/openwrt/packages.git|' -i feeds.conf.default - ./scripts/feeds update base packages - ./scripts/feeds install -a make defconfig make package/youtubeUnblock/compile V=s -j$(nproc) BUILD_LOG=1 @@ -71,15 +64,14 @@ jobs: if: always() env: ARCH: ${{ matrix.arch }} - BRANCH: ${{ matrix.branch }} run: | - tar -cJvf logs-$BRANCH-$ARCH.tar.xz /builder/logs + tar -cJvf logs-$ARCH.tar.xz /builder/logs - name: Upload packages if: steps.build.outcome == 'success' uses: actions/upload-artifact@v4 with: - name: ipk-${{ matrix.branch }}-${{ matrix.arch }} + name: ipk-${{ matrix.arch }} path: /builder/**/youtubeUnblock*.ipk if-no-files-found: error @@ -87,30 +79,5 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: logs-${{ matrix.branch }}-${{ matrix.arch }} - path: ./**/logs-${{ matrix.branch }}-${{ matrix.arch }}.tar.xz - - release: - needs: build - permissions: - contents: write - runs-on: ubuntu-latest - strategy: - matrix: - branch: ['23.05'] - steps: - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - pattern: ipk-* - - - name: Upload release assets - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - prerelease: false - tag: v${{ needs.build.outputs.version }}-owrt${{ matrix.branch }} - name: v${{ needs.build.outputs.version }} for OpenWrt ${{ matrix.branch }} - body: | - youtubeUnblock v${{ needs.build.outputs.version }} for OpenWrt ${{ matrix.branch }} - artifacts: ./**/*.ipk + name: logs-${{ matrix.arch }} + path: ./**/logs-*.tar.xz