Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
chenmozhijin committed Sep 22, 2024
1 parent 0d41e88 commit fb051ff
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 21 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/build-openwrt-py.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ jobs:
with:
path: /opt/OpenWrt-K
- name: 建立环境
uses: /opt/OpenWrt-K/.github/action/prepare
uses: ./../../../../../opt/OpenWrt-K/.github/action/prepare

- name: 准备
id: run
run: python3 -m build_helper --task prepare

- name: 上传
uses: /opt/OpenWrt-K/.github/action/upload
uses: ./../../../../../opt/OpenWrt-K/.github/action/upload

base-builds:
runs-on: ubuntu-22.04
Expand All @@ -59,7 +59,7 @@ jobs:
with:
path: /opt/OpenWrt-K
- name: 建立环境
uses: /opt/OpenWrt-K/.github/action/prepare
uses: ./../../../../../opt/OpenWrt-K/.github/action/prepare

- name: 准备编译
id: prepare
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:

- name: 上传
if: success() || failure()
uses: /opt/OpenWrt-K/.github/action/upload
uses: ./../../../../../opt/OpenWrt-K/.github/action/upload

build-packages:
runs-on: ubuntu-22.04
Expand All @@ -106,7 +106,7 @@ jobs:
with:
path: /opt/OpenWrt-K
- name: 建立环境
uses: /opt/OpenWrt-K/.github/action/prepare
uses: ./../../../../../opt/OpenWrt-K/.github/action/prepare

- name: 准备编译
id: prepare
Expand All @@ -127,7 +127,7 @@ jobs:

- name: 上传
if: success() || failure()
uses: /opt/OpenWrt-K/.github/action/upload
uses: ./../../../../../opt/OpenWrt-K/.github/action/upload

build-ImageBuilder:
runs-on: ubuntu-22.04
Expand All @@ -141,7 +141,7 @@ jobs:
with:
path: /opt/OpenWrt-K
- name: 建立环境
uses: /opt/OpenWrt-K/.github/action/prepare
uses: ./../../../../../opt/OpenWrt-K/.github/action/prepare

- name: 准备编译
id: prepare
Expand All @@ -162,7 +162,7 @@ jobs:

- name: 上传
if: success() || failure()
uses: /opt/OpenWrt-K/.github/action/upload
uses: ./../../../../../opt/OpenWrt-K/.github/action/upload

build-images:
runs-on: ubuntu-22.04
Expand All @@ -176,7 +176,7 @@ jobs:
with:
path: /opt/OpenWrt-K
- name: 建立环境
uses: /opt/OpenWrt-K/.github/action/prepare
uses: ./../../../../../opt/OpenWrt-K/.github/action/prepare

- name: 准备构建
id: prepare
Expand All @@ -188,7 +188,7 @@ jobs:

- name: 上传
if: success() || failure()
uses: /opt/OpenWrt-K/.github/action/upload
uses: ./../../../../../opt/OpenWrt-K/.github/action/upload

releases:
runs-on: ubuntu-22.04
Expand All @@ -201,7 +201,7 @@ jobs:
with:
path: /opt/OpenWrt-K
- name: 建立环境
uses: /opt/OpenWrt-K/.github/action/prepare
uses: ./../../../../../opt/OpenWrt-K/.github/action/prepare

- name: 发布
run: python3 -m build_helper --task releases --config ${{ matrix.config }}
15 changes: 6 additions & 9 deletions build_helper/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,13 @@ def build_image_builder(cfg: dict) -> None:
config = f.read()
with open(os.path.join(openwrt.path, ".config"), "w") as f:
for line in config.splitlines():
if match := re.match(r"CONFIG_(?P<name>.+)_IMAGES=y", line):
f.write(f"CONFIG_{match.group('name')}_IMAGE=n\n")
if match := re.match(r"CONFIG_(?P<name>[^_=]+)_IMAGES=y", line) or (match := re.match(r"CONFIG_TARGET_ROOTFS_(?P<name>[^_=]+)=y", line)):
name = match.group("name")
if name in ("ISO", "VMDK", "TARGZ", "CPIOGZ", "EXT4FS", "SQUASHF", "GZIP"):
logger.debug(f"不构建 {name} 格式镜像")
f.write(line.replace("=y", "=n") + "\n")
else:
match line:
case "CONFIG_TARGET_ROOTFS_TARGZ=y":
f.write("CONFIG_TARGET_ROOTFS_TARGZ=n\n")
case "CONFIG_TARGET_ROOTFS_CPIOGZ=y":
f.write("CONFIG_TARGET_ROOTFS_CPIOGZ=n\n")
case _:
f.write(line + "\n")
f.write(line + "\n")
openwrt.make_defconfig()

logger.info("下载编译所需源码...")
Expand Down
2 changes: 1 addition & 1 deletion build_helper/utils/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def dl_artifact(name: str, path: str) -> str:
for artifact in repo.get_artifacts():
if artifact.workflow_run.id == context.run_id and artifact.name == name:
dl_url = artifact.archive_download_url
logger.info(f'Downloading artifact {name} from {dl_url}')
logger.debug(f'Downloading artifact {name} from {dl_url}')
break
else:
msg = f'Artifact {name} not found'
Expand Down

0 comments on commit fb051ff

Please sign in to comment.