-
Notifications
You must be signed in to change notification settings - Fork 17
/
action.yml
81 lines (75 loc) · 3.12 KB
/
action.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
name: "Use ophub script to package Armvirt as ImmortalWrt"
author: "ophub"
description: "Package Armvirt as ImmortalWrt. Support Amlogic s9xxx tv box."
inputs:
mode:
description: "Choose script."
required: false
default: "ophub"
openwrt_path:
description: "Choose armvirt64 file path."
required: false
default: "immortalwrt/bin/targets/*/*/*rootfs.tar.gz"
openwrt_soc:
description: "Choose Amlogic SoC."
required: false
default: "hg680p_b860p"
openwrt_kernel:
description: "Choose kernel version."
required: false
default: "5.15.50_5.17.15_5.18.7"
auto_kernel:
description: "Auto use the latest kernel."
required: false
default: "false"
version_branch:
description: "Choose version branch."
required: false
default: "stable"
openwrt_size:
description: "Set the rootfs size(Unit: MiB)."
required: false
default: "1536"
runs:
using: "composite"
steps:
- shell: bash
run: |
cd ${GITHUB_ACTION_PATH}
echo -e "ophub package actions path: ${PWD}"
openwrt_filename="${{ inputs.openwrt_path }}"
openwrt_savepath="immortalwrt-armvirt"
echo -e "Get ImmortalWrt file input parameters: [ ${openwrt_filename} ]"
[ -z "${openwrt_filename}" ] && echo -e "The [ openwrt_path ] variable must be specified." && exit 1
[ -d "${openwrt_savepath}" ] || mkdir -p ${openwrt_savepath}
if [[ "${openwrt_filename}" == http* ]]; then
echo -e "Use wget to download file: [ ${openwrt_filename} ]"
wget ${openwrt_filename} -q -P ${openwrt_savepath} 2>/dev/null
else
echo -e "Copy files: [ ${openwrt_filename} ]"
cp -f ${GITHUB_WORKSPACE}/${openwrt_filename} ${openwrt_savepath} 2>/dev/null
fi
sync
echo -e "About the ${openwrt_savepath} directory: \n$(ls -l ${openwrt_savepath} 2>/dev/null)"
cd ${GITHUB_ACTION_PATH}
echo -e "Start to make ImmortalWrt..."
make_command=" -d"
[ -n "${{ inputs.openwrt_soc }}" ] && make_command="${make_command} -b ${{ inputs.openwrt_soc }}"
[ -n "${{ inputs.openwrt_kernel }}" ] && make_command="${make_command} -k ${{ inputs.openwrt_kernel }}"
[ -n "${{ inputs.auto_kernel }}" ] && make_command="${make_command} -a ${{ inputs.auto_kernel }}"
[ -n "${{ inputs.version_branch }}" ] && make_command="${make_command} -v ${{ inputs.version_branch }}"
[ -n "${{ inputs.openwrt_size }}" ] && make_command="${make_command} -s ${{ inputs.openwrt_size }}"
sudo chmod +x make
sudo ./make ${make_command}
cd ${GITHUB_ACTION_PATH}
echo -e "Output environment variables."
echo "PACKAGED_OUTPUTPATH=${PWD}/out" >> $GITHUB_ENV
echo "PACKAGED_OUTPUTDATE=$(date +"%m.%d.%H%M")" >> $GITHUB_ENV
echo "PACKAGED_STATUS=success" >> $GITHUB_ENV
echo -e "PACKAGED_OUTPUTPATH: ${PWD}/out"
echo -e "PACKAGED_OUTPUTDATE: $(date +"%m.%d.%H%M")"
echo -e "PACKAGED_STATUS: success"
echo -e "PACKAGED_OUTPUTPATH files list: \n$(ls -l ${PWD}/out 2>/dev/null)"
branding:
icon: "terminal"
color: "gray-dark"