-
Notifications
You must be signed in to change notification settings - Fork 825
142 lines (129 loc) · 5.18 KB
/
manual_release.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
#
# Copyright (c) 2022-2023 SMALLPROGRAM <https://github.com/smallprogram>
# Description: Auto compile
#
#
# Fork and compile the latest version yourself using Github Actions
# 1.Into the repository of your own fork
# 2.Into the repository [Settings]
# 3.[Code and automation - Actions] ↓ [General] → [Workflow permissions] ↓ Check the [Read and write permissions] and [Save]
# 4.Let's take [Actions]
#
name: "Auto compile with OpenWrt SDK"
on:
repository_dispatch:
workflow_dispatch:
inputs:
ssh:
description: 'SSH connection to Actions'
required: false
default: 'false'
push:
branches:
- 'master'
paths:
- 'luci-theme-argon/Makefile'
env:
TZ: Asia/Shanghai
jobs:
job_check:
if: github.repository == ${{ github.repository }}
name: Check Version
runs-on: ubuntu-latest
outputs:
argon_version: ${{ steps.check_version.outputs.latest_version }}
has_update: ${{ steps.check_version.outputs.has_update }}
steps:
- name: Checkout
uses: actions/checkout@main
with:
fetch-depth: 0
ref: 'master'
- name: Check version
id: check_version
env:
url_release: https://api.github.com/repos/${{ github.repository }}/releases/latest
run: |
latest_version=$(grep -oP 'PKG_VERSION:=\K.*' Makefile | sed 's/^/v/')
latest_release=$(wget -qO- -t1 -T2 ${{env.url_release}} | awk -F '"' '/tag_name/{print $4}')
has_update=$([ "${latest_version}" != "${latest_release}" ] && echo true || echo false)
echo "latest_version=${latest_version}" >> $GITHUB_OUTPUT
echo "has_update=${has_update}" >> $GITHUB_OUTPUT
echo "latest_version: ${latest_version}"
echo "latest_release: ${latest_release}"
echo "has_update: ${has_update}"
- name: Generate new tag & release
if: steps.check_version.outputs.has_update == 'true'
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: For openwrt official Snapshots LuCI master
tag_name: ${{steps.check_version.outputs.latest_version}}
job_build_argon:
name: Build Argon (master)
needs: job_check
if: needs.job_check.outputs.has_update == 'true'
runs-on: ubuntu-latest
steps:
- name: Install packages
run: |
echo "Install packages"
sudo -E apt-get -qq update
sudo -E apt-get -qq install zstd build-essential clang flex bison g++ gawk gcc-multilib g++-multilib gettext git libncurses5-dev libssl-dev python3-venv rsync unzip zlib1g-dev file wget
sudo -E apt-get -qq autoremove --purge
sudo -E apt-get -qq clean
- name: Cache openwrt SDK
id: cache-sdk
uses: actions/cache@v3
with:
path: sdk
key: openwrt-sdk-snapshot-x86-64
- name: Initialization environment
if: steps.cache-sdk.outputs.cache-hit != 'true'
env:
url_sdk: https://downloads.openwrt.org/snapshots/targets/x86/64/openwrt-sdk-x86-64_gcc-13.3.0_musl.Linux-x86_64.tar.zst
run: |
wget ${{ env.url_sdk }}
file_name=$(echo ${{env.url_sdk}} | awk -F/ '{print $NF}')
mkdir sdk && tar --zstd -xvf $file_name -C ./sdk --strip-components=1
cd sdk
echo "src-git base https://github.com/openwrt/openwrt.git;main" > feeds.conf
echo "src-git-full packages https://github.com/openwrt/packages.git;master" >> feeds.conf
echo "src-git-full luci https://github.com/openwrt/luci.git;master" >> feeds.conf
echo "src-git-full routing https://git.openwrt.org/feed/routing.git;master" >> feeds.conf
git clone -b master https://github.com/${{ github.repository }}.git package/downloads/luci-theme-argon
./scripts/feeds update -a
echo "CONFIG_PACKAGE_luci-theme-argon=m" > .config
./scripts/feeds install -d n luci-theme-argon
make download -j8
- name: Configure Argon (master)
run: |
cd sdk
./scripts/feeds install luci-theme-argon
echo "CONFIG_ALL_NONSHARED=n" > .config
echo "CONFIG_ALL_KMODS=n" >> .config
echo "CONFIG_ALL=n" >> .config
echo "CONFIG_AUTOREMOVE=n" >> .config
echo "CONFIG_LUCI_LANG_zh_Hans=y" >> .config
echo "CONFIG_PACKAGE_luci-theme-argon=m" >> .config
make defconfig
- name: Compile Argon (master)
id: compile
run: |
cd sdk
echo "make package/luci-theme-argon/{clean,compile} -j$(nproc)"
make package/luci-theme-argon/{clean,compile} -j$(nproc)
mv bin/packages/x86_64/base/ ../
rm .config .config.old
cd ..
echo "status=success" >> $GITHUB_OUTPUT
echo "FIRMWARE=$PWD" >> $GITHUB_ENV
- name: Upload Argon (master) ipks to release
uses: softprops/action-gh-release@v1
if: steps.compile.outputs.status == 'success'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{needs.job_check.outputs.argon_version}}
files: ${{ env.FIRMWARE }}/base/luci-theme*.*