build openwrt 23.05 #1
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
# | |
# Copyright (C) 2022-2023 hugcabbage <[email protected]> | |
# | |
# This is free software, licensed under the MIT License. | |
# | |
# <https://github.com/hugcabbage/shared-lede> | |
# | |
# The firmware code comes from openwrt openwrt-23.05 branch | |
# | |
name: build openwrt 23.05 | |
on: | |
workflow_dispatch: | |
inputs: | |
model: | |
description: '选择设备' | |
required: true | |
type: choice | |
options: | |
- 'xiaomi-cr6608' | |
- 'xiaomi-cr6606' | |
- 'xiaomi-cr6609' | |
- 'redmi-ac2100' | |
- 'xiaomi-ac2100' | |
- 'xiaomi-4a-gigabit' | |
- 'xiaomi-4a-gigabit-v2' | |
- 'xiaomi-3g-v2' | |
- 'xiaomi-3g' | |
- 'xiaomi-4' | |
- 'xiaomi-3-pro' | |
- 'phicomm-k2p' | |
- 'redmi-ax6s' | |
- 'xiaomi-4a-100m' | |
- 'xiaomi-4c' | |
- 'miwifi-nano' | |
- 'glinet-mt300n-v2' | |
- 'glinet-microuter-n300' | |
- 'miwifi-mini' | |
- 'miwifi-r3' | |
lan_ipad: | |
description: '设置LAN口IP地址(会覆盖modify脚本中的设置)' | |
required: false | |
default: '' | |
type: string | |
login_pwd: | |
description: '设置初始登陆密码(会覆盖modify脚本中的设置)' | |
required: false | |
default: '' | |
type: string | |
record: | |
description: '输入版本描述' | |
required: false | |
default: '升级内容:内核升级,更新应用版本' | |
type: string | |
switch_tag: | |
description: '切换到最近稳定版本' | |
required: false | |
type: boolean | |
release: | |
description: '上传到release' | |
required: false | |
default: true | |
type: boolean | |
artifact: | |
description: '上传到artifact' | |
required: false | |
type: boolean | |
permissions: | |
contents: write | |
jobs: | |
to-build: | |
name: build | |
runs-on: ubuntu-latest | |
env: | |
EXTRA_STR: _some | |
steps: | |
- name: display initial disk space | |
run: | | |
df -h | |
- name: checkout | |
uses: actions/checkout@v4 | |
with: | |
path: ${{ env.EXTRA_STR }} | |
- name: prepare environments | |
env: | |
REQUIREMENTS: ${{ env.EXTRA_STR }}/extra-files/requirements-transit.txt | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install gcc-multilib gettext libncurses5-dev | |
sudo apt-get clean | |
pip3 install -r $REQUIREMENTS | |
- name: prepare deployment | |
id: prepare-deployment | |
env: | |
MODEL_NAME: ${{ inputs.model }} | |
LOGIN_IP: ${{ inputs.lan_ipad }} | |
LOGIN_PWD: ${{ inputs.login_pwd }} | |
SWITCH_TAG: ${{ inputs.switch_tag }} | |
TEMP_PREFIX: ${{ env.EXTRA_STR }} | |
DEPLOY_DIR: ${{ env.EXTRA_STR }}/preset-openwrt | |
TRANSIT_PY: ${{ env.EXTRA_STR }}/extra-files/transit.py | |
run: | | |
chmod +x $TRANSIT_PY | |
$TRANSIT_PY | |
- name: clone sources | |
env: | |
CLONE_SH: ${{ steps.prepare-deployment.outputs.clone_sh }} | |
run: | | |
chmod +x $CLONE_SH | |
$CLONE_SH | |
- name: update feeds | |
run: | | |
./scripts/feeds update -a | |
./scripts/feeds install -a | |
- name: modify configuration | |
env: | |
MODIFY_SH: ${{ steps.prepare-deployment.outputs.modify_sh }} | |
run: | | |
chmod +x $MODIFY_SH | |
$MODIFY_SH | |
- name: generate .config | |
env: | |
DOT_CONFIG: ${{ steps.prepare-deployment.outputs.dot_config }} | |
run: | | |
mv $DOT_CONFIG .config | |
make defconfig | |
- name: make download | |
run: | | |
make download -j8 || make download -j1 V=s | |
- name: compile | |
run: | | |
make -j$(nproc) || make -j1 V=s | |
- name: pick up files | |
run: | | |
mkdir -p _collected_firmware/packages | |
rm -rf $(find bin/targets/ -type d -name 'packages') | |
cp $(find bin/targets/ -type f) _collected_firmware | |
cp $(find bin/packages/ -type f -name '*.ipk') _collected_firmware/packages | |
cd _collected_firmware | |
zip -r allfiles.zip * | |
cd packages | |
zip -r ../packages.zip * | |
- name: generate summary | |
id: generate-summary | |
env: | |
MODEL_NAME: ${{ inputs.model }} | |
CODE_DIR: ${{ steps.prepare-deployment.outputs.codedir }} | |
TRANSIT_PY: ${{ env.EXTRA_STR }}/extra-files/transit.py | |
run: | | |
chmod +x $TRANSIT_PY | |
$TRANSIT_PY | |
- name: calculate tag version | |
id: calculate-version | |
if: inputs.release == true | |
uses: hugcabbage/next-version@v1 | |
with: | |
repo_path: ${{ env.EXTRA_STR }} | |
- name: upload firmware to release | |
id: to-release | |
if: steps.calculate-version.conclusion == 'success' && inputs.release == true | |
continue-on-error: true | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
file: _collected_firmware/* | |
tag: ${{ steps.calculate-version.outputs.version }} | |
release_name: ${{ steps.calculate-version.outputs.version }} ${{ steps.generate-summary.outputs.stitle }} | |
overwrite: true | |
prerelease: false | |
body: | | |
${{ inputs.record }} | |
${{ steps.generate-summary.outputs.summary }} | |
file_glob: true | |
- name: upload firmware to artifact | |
if: inputs.artifact == true || steps.to-release.outcome != 'success' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: collected_firmware | |
path: | | |
_collected_firmware/ | |
!_collected_firmware/*.zip | |
- name: display finishing disk space | |
run: | | |
df -h | |
echo "----------------------------" | |
du -h --max-depth=1 |