CI #178
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
workflow_dispatch: | |
inputs: | |
push_branch: | |
description: 'Whether to push to binaries branch' | |
required: true | |
default: '0' | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
container: | |
image: pexcn/docker-images:bookworm-openwrt | |
env: | |
TZ: Asia/Taipei | |
SDK_URL: ${{ matrix.SDK_URL }} | |
strategy: | |
fail-fast: false | |
matrix: | |
SDK_URL: | |
- https://downloads.openwrt.org/releases/21.02.5/targets/x86/64/openwrt-sdk-21.02.5-x86-64_gcc-8.4.0_musl.Linux-x86_64.tar.xz | |
- https://github.com/openwrt-ipq60xx/ci/releases/download/main/openwrt-sdk-qualcommax-ipq60xx_gcc-12.3.0_musl.Linux-x86_64.tar.xz | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Build | |
run: ./build.sh | |
- name: Push | |
shell: bash | |
if: (github.event_name == 'push' && startsWith(github.event.head_commit.message, '[release] ')) || (github.event.inputs.push_branch == 1) | |
run: | | |
TARGET_PLATFORM="$(sed -n 's|.*targets/\(\w*\)/\(\w*\)/.*|\1-\2|p' <<<$SDK_URL)" | |
[ -n "$TARGET_PLATFORM" ] || TARGET_PLATFORM="$(cut -d- -f 4-5 <<<$SDK_URL | awk -F_ '{print $1}')" | |
# update packages | |
git clone https://github.com/${{ github.repository }}.git --single-branch -b $TARGET_PLATFORM --depth 1 feeds | |
rm -rf feeds/* | |
cp -r openwrt-sdk/bin/packages/*/base feeds/base | |
cp -r openwrt-sdk/bin/targets/${TARGET_PLATFORM%%-*}/${TARGET_PLATFORM##*-}/packages feeds/core | |
# commit and push | |
cd feeds | |
git config user.name github-actions[bot] | |
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
git add . | |
git commit -m "$(date '+%Y-%m-%d %T')" || true | |
git push https://${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git $TARGET_PLATFORM |