-
Notifications
You must be signed in to change notification settings - Fork 50
169 lines (148 loc) · 6.02 KB
/
Copy pathpackaging-armv8-openwrt.yml
File metadata and controls
169 lines (148 loc) · 6.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: packaging armv8 openwrt
on:
workflow_dispatch:
inputs:
source_repo:
description: '选择要打包的源码固件'
required: true
default: 'immwrt'
type: choice
options: ['immwrt', 'lean']
ip_address:
description: '设置默认IP地址'
required: false
default: '10.0.0.2'
openwrt_board:
description: '选择设备(CPU)型号'
required: true
default: 's905d_s905x3'
openwrt_kernel:
description: '设置内核版本'
required: true
default: '6.12.y_6.18.y'
script_repo:
description: '选择打包脚本储存库'
required: false
default: 'flippy'
type: choice
options: [flippy, ophub]
kernel_repo:
description: '选择内核存储库'
required: false
default: 'ophub/kernel'
type: choice
options: [ophub/kernel, breakingbadboy/OpenWrt]
customize_rk3399:
description: '设置rk3399设备(设备型号:dtb名称)'
required: false
default: ''
auto_kernel:
description: '自动使用最新内核'
required: false
default: true
type: boolean
upload_artifact:
description: '上传固件到Artifact'
required: false
default: false
type: boolean
upload_release:
description: '上传固件到Releases'
required: false
default: true
type: boolean
jobs:
packaging:
name: packaging armv8 ${{inputs.source_repo}}
runs-on: ubuntu-24.04
env:
IP_ADDRESS: ${{inputs.ip_address}}
CONFIG_FILE: configs/armv8-${{inputs.source_repo}}.config
DIY_SCRIPT: ${{inputs.source_repo}}.sh
RELEASE_TAG: armv8-${{inputs.source_repo}}
TZ: Asia/Shanghai
steps:
- name: Checkout
uses: actions/checkout@main
- name: Initialization Environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android $AGENT_TOOLSDIRECTORY
sudo -E apt -yqq update
sudo -E apt -yqq install rename $(curl -fsSL is.gd/depends_ubuntu_2404)
sudo -E apt -yqq autoremove --purge
sudo -E apt -yqq autoclean
sudo -E apt -yqq clean
sudo timedatectl set-timezone "$TZ"
- name: Generate Variables
run: |
REPO_URL=$(grep -oP 'REPO_URL="\K[^"]+' $DIY_SCRIPT)
echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV
echo "SOURCE_REPO=$(basename $REPO_URL)" >> $GITHUB_ENV
REPO_BRANCH=$(grep -oP 'REPO_BRANCH="\K[^"]+' $DIY_SCRIPT)
echo "REPO_BRANCH=$REPO_BRANCH" >> $GITHUB_ENV
echo "LITE_BRANCH=${REPO_BRANCH#*-}" >> $GITHUB_ENV
TARGET_NAME=$(grep -oP "^CONFIG_TARGET_\K[a-z0-9]+(?==y)" $CONFIG_FILE)
SUBTARGET_NAME=$(grep -oP "^CONFIG_TARGET_${TARGET_NAME}_\K[a-z0-9]+(?==y)" $CONFIG_FILE)
echo "DEVICE_TARGET=$TARGET_NAME-$SUBTARGET_NAME" >> $GITHUB_ENV
- name: Download OpenWrt Firmware
id: download
run: |
FIRMWARE_PATH=openwrt/bin/targets/armvirt/64
[ -d "$FIRMWARE_PATH" ] || mkdir -p "$FIRMWARE_PATH"
echo -e $(curl -sL https://api.github.com/repos/$GITHUB_REPOSITORY/releases | grep "$DEVICE_TARGET.*$REPO_URL.*$REPO_BRANCH" | cut -d '"' -f4) > release.txt
[ -n "$IP_ADDRESS" ] && sed -Ei "s/\b([0-9]{1,3}\.){3}[0-9]{1,3}\b/${IP_ADDRESS}/g" release.txt
cd $FIRMWARE_PATH
wget -q $(curl -sL https://api.github.com/repos/$GITHUB_REPOSITORY/releases | grep "$RELEASE_TAG/" | grep -v img.gz | cut -d '"' -f4)
echo "FIRMWARE_PATH=$PWD" >> $GITHUB_ENV
echo "FILE_DATE=$(date +"%Y.%m.%d")" >> $GITHUB_ENV
echo "DATE=$(date +"%Y.%m.%d-%H:%M:%S")" >> $GITHUB_ENV
- name: Use Flippy Script Packaging
if: steps.download.conclusion == 'success' && github.event.inputs.script_repo == 'flippy'
uses: haiibo/flippy-openwrt-actions@main
env:
OPENWRT_ARMSR: openwrt/bin/targets/*/*/*rootfs.tar.gz
PACKAGE_SOC: ${{inputs.openwrt_board}}
KERNEL_REPO_URL: ${{inputs.kernel_repo}}
KERNEL_VERSION_NAME: ${{inputs.openwrt_kernel}}
KERNEL_AUTO_LATEST: ${{inputs.auto_kernel}}
OPENWRT_IP: ${{inputs.ip_address}}
CUSTOMIZE_RK3399: ${{inputs.customize_rk3399}}
WHOAMI: flippy
- name: Use Ophub Script Packaging
if: steps.download.conclusion == 'success' && github.event.inputs.script_repo == 'ophub'
uses: ophub/amlogic-s9xxx-openwrt@main
with:
openwrt_path: openwrt/bin/targets/*/*/*rootfs.tar.gz
openwrt_ip: ${{inputs.ip_address}}
openwrt_board: ${{inputs.openwrt_board}}
openwrt_kernel: ${{inputs.openwrt_kernel}}
auto_kernel: ${{inputs.auto_kernel}}
kernel_repo: ${{inputs.kernel_repo}}
builder_name: flippy
- name: Organize Files
if: env.PACKAGED_STATUS == 'success'
run: |
cd $PACKAGED_OUTPUTPATH
rm -f *rootfs.tar.gz *.sha
if [[ $SOURCE_REPO == 'immortalwrt' ]]; then
rename 's/openwrt/${{env.SOURCE_REPO}}/' *
fi
- name: Upload Firmware To Artifact
if: env.PACKAGED_STATUS == 'success' && github.event.inputs.upload_artifact == 'true'
uses: actions/upload-artifact@main
with:
name: ${{env.SOURCE_REPO}}-${{env.LITE_BRANCH}}-${{env.DEVICE_TARGET}}-firmware-${{env.FILE_DATE}}
path: ${{env.PACKAGED_OUTPUTPATH}}
- name: Upload Firmware To Release
if: env.PACKAGED_STATUS == 'success' && github.event.inputs.upload_release == 'true'
uses: ncipollo/release-action@main
with:
name: ${{env.RELEASE_TAG}}-${{env.DATE}}
allowUpdates: true
removeArtifacts: true
tag: ${{env.RELEASE_TAG}}
token: ${{secrets.GITHUB_TOKEN}}
artifacts: ${{env.FIRMWARE_PATH}}/*,${{env.PACKAGED_OUTPUTPATH}}/*
bodyFile: release.txt