forked from 281677160/build-actions
-
Notifications
You must be signed in to change notification settings - Fork 0
executable file
·178 lines (166 loc) · 6.12 KB
/
packaging.yml
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
170
171
172
173
174
175
176
177
178
#
# 打包Amlogic/Rockchip固件,请勿修改文件名称(packaging.yml)
#
name: 打包Amlogic/Rockchip固件
on:
repository_dispatch:
workflow_dispatch:
inputs:
source_branch:
description: '选择源码(先确认您已经编译了有)'
required: true
default: 'Lede'
type: choice
options:
- 'Lede'
- 'Immortalwrt'
- 'Lienol'
- 'Official'
- 'Xwrt'
amlogic_model:
description: '输入机型,比如:s905d 或 s905d_s905x2'
required: true
default: ''
amlogic_kernel:
description: '输入内核,比如:5.10.172 或 5.15.97_6.1.16'
required: true
default: ''
kernel_usage:
description: "内核仓库:stable、dev、flippy、rk3588"
required: true
default: 'stable'
type: choice
options:
- 'stable'
- 'dev'
- 'flippy'
- 'rk3588'
rootfs_size:
description: '设置rootfs大小(单位:MiB)'
required: true
default: '2560'
type: choice
options:
- '2560'
- '3840'
- '5120'
- '6400'
auto_kernel:
description: '是否自动检测最新内核'
required: true
default: 'true'
type: choice
options:
- 'true'
- 'false'
UPLOAD_FIRMWARE:
description: '上传固件到 Github Artifacts'
required: false
default: 'false'
type: boolean
UPLOAD_RELEASE:
description: '发布固件到 Github Releases'
required: false
default: 'true'
type: boolean
push:
branches:
- main
paths:
- 'bconfig'
env:
GITHUB_LINK: https://github.com/${{github.repository}}
GIT_REPOSITORY: ${{github.repository}}
REPO_TOKEN: ${{ secrets.REPO_TOKEN }}
TZ: Asia/Shanghai
FOLDER_NAME: Lede
SOURCE: Lede
jobs:
build:
name: 打包Amlogic、Rockchip固件
runs-on: ubuntu-22.04
if: ${{ github.event.repository.owner.id }} == ${{ github.event.sender.id }}
steps:
- name: 释放Ubuntu磁盘空间
uses: endersonmenezes/free-disk-space@v2
with:
remove_android: true
remove_dotnet: true
remove_haskell: true
remove_tool_cache: true
remove_swap: true
remove_packages: "azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox postgresql* temurin-* *llvm* mysql* dotnet-sdk-*"
remove_packages_one_command: true
remove_folders: "/usr/share/swift /usr/share/miniconda /usr/share/az* /usr/share/glade* /usr/local/lib/node_modules /usr/local/share/chromium /usr/local/share/powershell"
testing: false
- name: 准备结束
uses: actions/checkout@v4
- name: 读取脚本设置
run: |
cd ${GITHUB_WORKSPACE}
git clone https://github.com/281677160/common build/common
chmod -R +x build
if [[ -n "${{ github.event.inputs.amlogic_model }}" ]]; then
echo "SOURCE=${{ inputs.source_branch }}" >> ${GITHUB_ENV}
echo "amlogic_model=${{ github.event.inputs.amlogic_model }}" >> ${GITHUB_ENV}
echo "amlogic_kernel=${{ github.event.inputs.amlogic_kernel }}" >> ${GITHUB_ENV}
echo "rootfs_size=${{ github.event.inputs.rootfs_size }}" >> ${GITHUB_ENV}
echo "auto_kernel=${{ github.event.inputs.auto_kernel }}" >> ${GITHUB_ENV}
echo "kernel_usage=${{ github.event.inputs.kernel_usage }}" >> ${GITHUB_ENV}
echo "UPLOAD_FIRMWARE=${{ github.event.inputs.UPLOAD_FIRMWARE }}" >> ${GITHUB_ENV}
echo "UPLOAD_RELEASE=${{ github.event.inputs.UPLOAD_RELEASE }}" >> ${GITHUB_ENV}
else
source build/${FOLDER_NAME}/relevance/${SOURCE}.ini
echo "SOURCE=${SOURCE}" >> ${GITHUB_ENV}
echo "amlogic_model=${amlogic_model}" >> ${GITHUB_ENV}
echo "amlogic_kernel=${amlogic_kernel}" >> ${GITHUB_ENV}
echo "rootfs_size=${rootfs_size}" >> ${GITHUB_ENV}
echo "auto_kernel=${auto_kernel}" >> ${GITHUB_ENV}
echo "kernel_usage=${kernel_usage}" >> ${GITHUB_ENV}
echo "UPLOAD_FIRMWARE=${UPLOAD_FIRMWARE}" >> ${GITHUB_ENV}
echo "UPLOAD_RELEASE=${UPLOAD_RELEASE}" >> ${GITHUB_ENV}
fi
- name: 部署编译环境
env:
DEBIAN_FRONTEND: noninteractive
run: |
source ${GITHUB_WORKSPACE}/build/common/common.sh && Diy_update
sudo timedatectl set-timezone "$TZ"
sudo mkdir -p /workdir
sudo chown $USER:$GROUPS /workdir
- name: 建立打包文件夹
working-directory: /workdir
run: |
df -hT $PWD
mkdir -p openwrt
ln -sf /workdir/openwrt $GITHUB_WORKSPACE/openwrt
echo "HOME_PATH=${GITHUB_WORKSPACE}/openwrt" >> ${GITHUB_ENV}
- name: 打包固件
id: compile
run: |
cd ${GITHUB_WORKSPACE}
cp -Rf `find ./ -maxdepth 1 -type d ! -path './openwrt' ! -path './'` openwrt
cd openwrt
source build/common/common.sh && Package_amlogic
echo "date=$(date "+%Y%m%d%H%M%S")" >> ${GITHUB_ENV}
echo "date_tg=$(date +"%Y.%m%d.%H%M")" >> ${GITHUB_ENV}
- name: 上传固件在 github Artifacts
if: steps.compile.outcome == 'success' && env.UPLOAD_FIRMWARE == 'true'
uses: actions/upload-artifact@main
with:
name: OpenWrt-${{ env.source_codename }}-${{ env.kernel_usage }}-${{ env.date }}-firmware
path: ${{ env.FIRMWARE_PATH }}
- name: 发布固件到 Github Releases
if: steps.compile.outcome == 'success' && env.UPLOAD_RELEASE == 'true' && env.REPO_TOKEN
uses: ncipollo/release-action@v1
with:
name: ${{ env.amlogic_model }}
tag: ${{ env.date }}
token: ${{ secrets.REPO_TOKEN }}
allowUpdates: true
artifacts: "${{ env.FIRMWARE_PATH }}/*"
body: |
发布日期:${{ env.date_tg }}
固件源码:${{ env.source_codename }}
内核仓库:${{ env.kernel_usage }}
写入EMMC:Login to OpenWrt → System → Amlogic Service → Install OpenWrt