forked from ophub/amlogic-s9xxx-openwrt
-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (90 loc) · 4.32 KB
/
use-releases-file-to-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
#========================================================================================================================
# https://github.com/ophub/amlogic-s9xxx-openwrt
# Description: Use Releases file to packaging
# Cron: min (0 - 59) / hour (0 - 23) / day of month (1 - 31) / month (1 - 12) / day of week (0 - 6)(Sunday - Saturday)
#========================================================================================================================
name: Use Releases file to Packaging
on:
repository_dispatch:
workflow_dispatch:
inputs:
branch:
description: 'Select Branch [ official / lede ]'
required: false
default: 'lede'
#schedule:
#- cron: '0 22 * * *'
env:
UPLOAD_FIRMWARE: false
UPLOAD_RELEASE: true
UPLOAD_WETRANSFER: false
RECENT_LASTEST: 3
TZ: Asia/Jakarta
jobs:
build:
runs-on: ubuntu-20.04
if: github.event.repository.owner.id == github.event.sender.id
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Initialization environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc
sudo -E apt-get -qq update
sudo -E apt-get -qq install $(curl -fsSL git.io/ubuntu-2004-openwrt)
sudo -E apt-get -qq autoremove --purge
sudo -E apt-get -qq clean
sudo timedatectl set-timezone "$TZ"
# Input value validation
ARR_BRANCH=("official" "lede")
if [[ -n "${{ github.event.inputs.branch }}" && -n "$(echo "${ARR_BRANCH[@]}" | grep -w "${{ github.event.inputs.branch }}")" ]]; then
RELEASES_BRANCH=${{ github.event.inputs.branch }}
else
RELEASES_BRANCH=lede
fi
echo "RELEASES_BRANCH=${RELEASES_BRANCH}" >> $GITHUB_ENV
echo "COMPILE_STARTINGTIME=$(date +"%Y.%m.%d.%H%M")" >> $GITHUB_ENV
- name: Build OpenWrt firmware
id: build
if: (!cancelled())
run: |
[ -d openwrt-armvirt ] || mkdir -p openwrt-armvirt
curl -s "https://api.github.com/repos/${GITHUB_REPOSITORY}/releases" | grep -o "openwrt_s9xxx_${{ env.RELEASES_BRANCH }}.*/openwrt-armvirt-.*.tar.gz" | head -n 1 > DOWNLOAD_ARMVIRT
[ -s DOWNLOAD_ARMVIRT ] && wget -q -P openwrt-armvirt https://github.com/${GITHUB_REPOSITORY}/releases/download/$(cat DOWNLOAD_ARMVIRT)
sudo chmod +x make
sudo ./make -d -b s905x -k 5.10.80_5.4.160
curl -s "https://api.github.com/repos/${GITHUB_REPOSITORY}/releases" | grep -o "openwrt_s9xxx_${{ env.RELEASES_BRANCH }}.*/ipk.tar.gz" | head -n 1 > DOWNLOAD_IPK
[ -s DOWNLOAD_IPK ] && wget -q -P out https://github.com/${GITHUB_REPOSITORY}/releases/download/$(cat DOWNLOAD_IPK)
echo "PACKAGED_OUTPUTPATH=${PWD}/out" >> $GITHUB_ENV
echo "PACKAGED_OUTPUTDATE=$(date +"%Y.%m.%d.%H%M")" >> $GITHUB_ENV
echo "::set-output name=status::success"
- name: Upload artifact to Actions
uses: kittaakos/upload-artifact-as-is@master
if: steps.build.outputs.status == 'success' && env.UPLOAD_FIRMWARE == 'true' && !cancelled()
with:
path: ${{ env.PACKAGED_OUTPUTPATH }}/
- name: Upload OpenWrt Firmware to WeTransfer
if: steps.build.outputs.status == 'success' && env.UPLOAD_WETRANSFER == 'true' && !cancelled()
run: |
curl -fsSL git.io/file-transfer | sh
./transfer wet -s -p 16 --no-progress ${{ env.PACKAGED_OUTPUTPATH }}/{openwrt_s9xxx_*,openwrt_n1_*} 2>&1 | tee wetransfer.log
echo "WET_URL=$(cat wetransfer.log | grep https | cut -f3 -d" ")" >> $GITHUB_ENV
- name: Upload OpenWrt Firmware to Release
uses: ncipollo/release-action@v1
if: steps.build.outputs.status == 'success' && env.UPLOAD_RELEASE == 'true' && !cancelled()
with:
tag: openwrt_s9xxx_${{ env.RELEASES_BRANCH }}_${{ env.PACKAGED_OUTPUTDATE }}
artifacts: ${{ env.PACKAGED_OUTPUTPATH }}/*
allowUpdates: true
token: ${{ secrets.GITHUB_TOKEN }}
body: |
This is OpenWrt firmware for Amlogic S9xxx STB
* Firmware information
Default IP: 192.168.1.1
Default username: root
Default password: password
Default WIFI name: OpenWrt
Default WIFI password: none
Install to EMMC: Login to OpenWrt → System → Amlogic Service → Install OpenWrt