Skip to content

build-openwrt

build-openwrt #13

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: build-openwrt
# The type of start
on:
repository_dispatch:
workflow_dispatch:
inputs:
version:
description: '版本'
required: true
default: '24.10'
ssh:
description: '是否开启ssh调试'
required: true
default: 'false'
type: choice
options:
- 'true'
- 'false'
jobs:
build:
name: build ${{ matrix.device }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
device:
- redmi_ax6000
- xiaomi_ac2100
steps:
- name: Checkout
uses: actions/checkout@main
# 初始化环境变量
- name: ${{ matrix.device }} init-env
run: |
echo "export project_version=${{ github.event.inputs.version }}" >> $HOME/.profile
echo "RELEASE_DATE=$(date +"%Y%m%d%H%M")" >> $GITHUB_ENV
source $HOME/.profile
- name: Initialization environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
curl https://raw.githubusercontent.com/codetiger666/linux/refs/heads/master/scripts/linux/init-github-ubuntu | bash
- name: ${{ matrix.device }} Clone Openwrt source code
run: |
git clone -b ${{ github.event.inputs.version }} https://github.com/codetiger666/openwrt.git openwrt
- name: ${{ matrix.device }} Update & Install Feeds
run: |
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a
- name: ${{ matrix.device }} Run Diy-Part1 Scripts
run: |
source $HOME/.profile
source scripts/BaseScripts.sh
Core_${{ matrix.device }}
Diy-Part1
echo "Artifacts_DATE=$(date +"%Y%m%d%H%M")" >> $GITHUB_ENV
- name: ${{ matrix.device }} make defconfig
run: |
[ -f ${{ matrix.device }}.config ] && mv ${{ matrix.device }}.config openwrt/.config
cd openwrt
make defconfig
- name: ${{ matrix.device }} SSH connection to Actions
uses: P3TERX/ssh2actions@main
if: github.event.inputs.ssh == 'true'
env:
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
- name: ${{ matrix.device }} Download Packages
working-directory: ./openwrt
run: |
make download -j V=s
- name: ${{ matrix.device }} Compile the Openwrt
working-directory: ./openwrt
run: |
make -j$(nproc) V=s
- name: ${{ matrix.device }} Recompile the Openwrt
working-directory: ./openwrt
if: failure()
run: |
make -j1 V=s
- name: Upload Firmware to Artifacts
uses: actions/upload-artifact@main
with:
name: ${{ matrix.device }}
path: openwrt/bin
release:
name: release
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@main
- name: Init ENV
run: |
echo "RELEASE_DATE=$(date +"%Y%m%d%H%M")" >> $GITHUB_ENV
- name: download artifact
uses: actions/download-artifact@main
with:
path: artifacts
- name: copy file to Releases
run: |
source scripts/BaseScripts.sh
source $HOME/.profile
devices=("redmi_ax6000" "xiaomi_ac2100")
for device in "${devices[@]}"; do
Diy-Part2_$device
done
- name: Upload Firmware to Releases
uses: softprops/action-gh-release@master
with:
draft: false
make_latest: true
tag_name: openwrt-${{ github.event.inputs.version }}-${{ env.RELEASE_DATE }}
files: release/*
- name: Remove workflow runs
uses: GitRML/delete-workflow-runs@main
with:
retain_days: 1
keep_minimum_runs: 3