forked from tjuyy/Phicomm-K2P-Openwrt-Autobuild
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
#================================================= | ||
# Description: Tp 703v1 Openwrt Autobuild | ||
# Lisence: MIT | ||
# Author: tjuyy | ||
#================================================= | ||
name: Build Lean's OpenWrt for 703v1 | ||
|
||
on: | ||
release: | ||
types: [published] | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- "703v1.config" | ||
# schedule: | ||
# - cron: 0 8 * * 5 | ||
watch: | ||
types: [started] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-18.04 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@master | ||
|
||
- name: Initialization environment | ||
env: | ||
DEBIAN_FRONTEND: noninteractive | ||
run: | | ||
echo "Deleting files, please wait ..." | ||
sudo rm -rf /usr/share/dotnet /etc/apt/sources.list.d/* | ||
sudo swapoff /swapfile | ||
sudo rm -f /swapfile | ||
#docker rmi `docker images -q` | ||
#sudo -E apt-get -q purge azure-cli ghc* zulu* hhvm llvm* firefox google* dotnet* powershell openjdk* mysql* php* | ||
sudo -E apt-get -qq update | ||
sudo -E apt-get -qq install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler | ||
sudo -E apt-get -qq autoremove --purge | ||
sudo -E apt-get -qq clean | ||
curl -fsSL https://raw.githubusercontent.com/P3TERX/dotfiles/master/.bashrc >> ~/.bashrc | ||
sudo ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime | ||
|
||
- name: Clone source code | ||
env: | ||
REPO_URL: https://github.com/coolsnowwolf/lede | ||
REPO_BRANCH: master | ||
run: git clone --depth 1 $REPO_URL -b $REPO_BRANCH openwrt | ||
|
||
- name: Update & install feeds | ||
run: cd openwrt && ./scripts/feeds update -a && ./scripts/feeds install -a | ||
|
||
- name: Load custom configuration | ||
env: | ||
CONFIG_FILE: "703v1.config" | ||
DIY_SH: "diy.sh" | ||
run: | | ||
[ -e files ] && mv files openwrt/files | ||
[ -e $CONFIG_FILE ] && mv $CONFIG_FILE openwrt/.config | ||
chmod +x $DIY_SH | ||
cd openwrt | ||
../$DIY_SH | ||
make defconfig | ||
|
||
# - name: SSH connection to Actions | ||
# uses: P3TERX/debugger-action@master | ||
|
||
- name: Download package | ||
run: | | ||
cd openwrt && make download -j8 | ||
find dl -size -1024c -exec ls -l {} \; | ||
find dl -size -1024c -exec rm -f {} \; | ||
|
||
- name: Multi-thread compile | ||
run: | | ||
cd openwrt | ||
echo -e "$(nproc) thread compile" | ||
make -j$(nproc) | ||
|
||
- name: Single-thread compile | ||
if: failure() | ||
run: | | ||
cd openwrt | ||
make -j1 V=s | ||
|
||
- name: Upload bin directory | ||
uses: actions/upload-artifact@master | ||
if: always() | ||
with: | ||
name: OpenWrt_K2P_bin | ||
path: openwrt/bin | ||
|
||
- name: Remove packages | ||
if: always() | ||
run: | | ||
cd openwrt/bin/targets/*/* | ||
rm -rf packages | ||
echo "::set-env name=FIRMWARE::$(pwd)" | ||
|
||
- name: Upload firmware to Artifact | ||
uses: actions/upload-artifact@master | ||
if: always() | ||
with: | ||
name: OpenWrt-703v1-Firmware | ||
path: ${{ env.FIRMWARE }} | ||
|
||
- name: Publish release | ||
uses: softprops/action-gh-release@v1 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
files: openwrt/bin/targets/ar71xx/tiny/* | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.RELEASES_DEPLOY_TOKEN }} |