forked from v2rayA/v2raya-openwrt
-
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
1 parent
e2ac284
commit 112eae1
Showing
1 changed file
with
305 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,305 @@ | ||
# | ||
# Copyright (c) 2022-2023 SMALLPROGRAM <https://github.com/smallprogram> | ||
# Description: Auto compile | ||
# | ||
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-app-v2raya/Makefile' | ||
env: | ||
TZ: Asia/Makassar | ||
v2raya: ${{ github.repository }} | ||
packages: esaaprillia/v2raya | ||
|
||
jobs: | ||
job_check: | ||
name: Check Version | ||
runs-on: ubuntu-latest | ||
outputs: | ||
v2raya_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/${{ env.v2raya }}/releases/latest | ||
run: | | ||
cd luci-app-v2raya | ||
latest_version=$(awk -F ':=' '/PKG_VERSION|PKG_RELEASE/ {print $2}' Makefile | sed ':a;N;s/\n$//;s/\n/-/;ba') | ||
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: Prepare release | ||
if: steps.check_version.outputs.has_update == 'true' | ||
run: | | ||
echo "## :mega:Update content" >> release.txt | ||
echo "![](https://img.shields.io/github/downloads/${{ env.v2raya }}/${{steps.check_version.outputs.latest_version}}/total?style=flat-square)" >> release.txt | ||
echo "### v2raya Info" >> release.txt | ||
echo "**:minidisc: v2raya Version: ${{steps.check_version.outputs.latest_version}}**" >> release.txt | ||
echo "**:gear: OpenWrt SDK Version: 21.02.7**" >> release.txt | ||
touch release.txt | ||
- 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: | ||
tag_name: ${{steps.check_version.outputs.latest_version}} | ||
body_path: release.txt | ||
|
||
|
||
job_build_v2raya: | ||
name: Build v2raya | ||
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 build-essential clang flex bison g++ gawk gcc-multilib g++-multilib gettext git libncurses5-dev libssl-dev python3-distutils 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-21.02.7-x86-64 | ||
|
||
- name: Initialization environment | ||
if: steps.cache-sdk.outputs.cache-hit != 'true' | ||
env: | ||
url_sdk: https://downloads.openwrt.org/releases/21.02.7/targets/x86/64/openwrt-sdk-21.02.7-x86-64_gcc-8.4.0_musl.Linux-x86_64.tar.xz | ||
run: | | ||
wget ${{ env.url_sdk }} | ||
file_name=$(echo ${{env.url_sdk}} | awk -F/ '{print $NF}') | ||
mkdir sdk && tar -xJf $file_name -C ./sdk --strip-components=1 | ||
cd sdk | ||
echo "src-git v2raya https://github.com/${{ env.v2raya }}.git;master" >> feeds.conf.default | ||
./scripts/feeds update -a | ||
echo "CONFIG_PACKAGE_luci-app-v2raya=m" > .config | ||
./scripts/feeds install -d n luci-app-v2raya | ||
make download -j8 | ||
- name: Configure v2raya | ||
run: | | ||
cd sdk | ||
./scripts/feeds update v2raya | ||
./scripts/feeds install luci-app-v2raya | ||
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-app-v2raya=m" >> .config | ||
make defconfig | ||
- name: Compile v2raya | ||
id: compile | ||
run: | | ||
cd sdk | ||
echo "make package/luci-app-v2raya/{clean,compile} -j$(nproc)" | ||
make package/luci-app-v2raya/{clean,compile} -j$(nproc) | ||
mv bin/packages/x86_64/v2raya/ ../ | ||
rm .config .config.old | ||
cd .. | ||
echo "status=success" >> $GITHUB_OUTPUT | ||
echo "FIRMWARE=$PWD" >> $GITHUB_ENV | ||
- name: Upload v2raya 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.v2raya_version}} | ||
files: ${{ env.FIRMWARE }}/v2raya/luci*.ipk | ||
|
||
|
||
job_auto_compile: | ||
if: needs.job_check.outputs.has_update == 'true' | ||
needs: job_check | ||
runs-on: ubuntu-latest | ||
name: build (${{ matrix.platform }}) | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- platform: x86_64 | ||
url_sdk: https://downloads.openwrt.org/releases/21.02.7/targets/x86/64/openwrt-sdk-21.02.7-x86-64_gcc-8.4.0_musl.Linux-x86_64.tar.xz | ||
|
||
- platform: aarch64_generic | ||
url_sdk: https://downloads.openwrt.org/releases/21.02.7/targets/rockchip/armv8/openwrt-sdk-21.02.7-rockchip-armv8_gcc-8.4.0_musl.Linux-x86_64.tar.xz | ||
|
||
- platform: aarch64_cortex-a53 | ||
url_sdk: https://downloads.openwrt.org/releases/21.02.7/targets/mvebu/cortexa53/openwrt-sdk-21.02.7-mvebu-cortexa53_gcc-8.4.0_musl.Linux-x86_64.tar.xz | ||
|
||
- platform: aarch64_cortex-a72 | ||
url_sdk: https://downloads.openwrt.org/releases/21.02.7/targets/mvebu/cortexa72/openwrt-sdk-21.02.7-mvebu-cortexa72_gcc-8.4.0_musl.Linux-x86_64.tar.xz | ||
|
||
- platform: arm_cortex-a7 | ||
url_sdk: https://downloads.openwrt.org/releases/21.02.7/targets/mediatek/mt7629/openwrt-sdk-21.02.7-mediatek-mt7629_gcc-8.4.0_musl_eabi.Linux-x86_64.tar.xz | ||
|
||
- platform: arm_cortex-a7_neon-vfpv4 | ||
url_sdk: https://downloads.openwrt.org/releases/21.02.7/targets/sunxi/cortexa7/openwrt-sdk-21.02.7-sunxi-cortexa7_gcc-8.4.0_musl_eabi.Linux-x86_64.tar.xz | ||
|
||
- platform: arm_cortex-a8_vfpv3 | ||
url_sdk: https://downloads.openwrt.org/releases/21.02.7/targets/sunxi/cortexa8/openwrt-sdk-21.02.7-sunxi-cortexa8_gcc-8.4.0_musl_eabi.Linux-x86_64.tar.xz | ||
|
||
- platform: arm_cortex-a9 | ||
url_sdk: https://downloads.openwrt.org/releases/21.02.7/targets/bcm53xx/generic/openwrt-sdk-21.02.7-bcm53xx-generic_gcc-8.4.0_musl_eabi.Linux-x86_64.tar.xz | ||
|
||
- platform: arm_cortex-a9_neon | ||
url_sdk: https://downloads.openwrt.org/releases/21.02.7/targets/zynq/generic/openwrt-sdk-21.02.7-zynq_gcc-8.4.0_musl_eabi.Linux-x86_64.tar.xz | ||
|
||
- platform: arm_cortex-a9_vfpv3-d16 | ||
url_sdk: https://downloads.openwrt.org/releases/21.02.7/targets/mvebu/cortexa9/openwrt-sdk-21.02.7-mvebu-cortexa9_gcc-8.4.0_musl_eabi.Linux-x86_64.tar.xz | ||
|
||
- platform: arm_cortex-a15_neon-vfpv4 | ||
url_sdk: https://downloads.openwrt.org/releases/21.02.7/targets/ipq806x/generic/openwrt-sdk-21.02.7-ipq806x-generic_gcc-8.4.0_musl_eabi.Linux-x86_64.tar.xz | ||
|
||
- platform: mips_24kc | ||
url_sdk: https://downloads.openwrt.org/releases/21.02.7/targets/ath79/generic/openwrt-sdk-21.02.7-ath79-generic_gcc-8.4.0_musl.Linux-x86_64.tar.xz | ||
|
||
- platform: mips_4kec | ||
url_sdk: https://downloads.openwrt.org/releases/21.02.7/targets/realtek/generic/openwrt-sdk-21.02.7-realtek-generic_gcc-8.4.0_musl.Linux-x86_64.tar.xz | ||
|
||
- platform: mips_mips32 | ||
url_sdk: https://downloads.openwrt.org/releases/21.02.7/targets/bcm63xx/generic/openwrt-sdk-21.02.7-bcm63xx-generic_gcc-8.4.0_musl.Linux-x86_64.tar.xz | ||
|
||
- platform: mipsel_24kc | ||
url_sdk: https://downloads.openwrt.org/releases/21.02.7/targets/ramips/rt288x/openwrt-sdk-21.02.7-ramips-rt288x_gcc-8.4.0_musl.Linux-x86_64.tar.xz | ||
|
||
- platform: mipsel_74kc | ||
url_sdk: https://downloads.openwrt.org/releases/21.02.7/targets/ramips/rt3883/openwrt-sdk-21.02.7-ramips-rt3883_gcc-8.4.0_musl.Linux-x86_64.tar.xz | ||
|
||
- platform: mipsel_mips32 | ||
url_sdk: https://downloads.openwrt.org/releases/21.02.7/targets/bcm47xx/generic/openwrt-sdk-21.02.7-bcm47xx-generic_gcc-8.4.0_musl.Linux-x86_64.tar.xz | ||
|
||
steps: | ||
- name: Initialization ${{ matrix.platform }} compile environment | ||
run: | | ||
echo "install packages!!!!!!" | ||
sudo -E apt-get -qq update | ||
sudo -E apt-get -qq install $(curl -fsSL https://github.com/smallprogram/OpenWrtAction/raw/main/diy_script/official_dependence) | ||
sudo -E apt-get -qq autoremove --purge | ||
sudo -E apt-get -qq clean | ||
- name: ${{ matrix.platform }} sdk download | ||
run: | | ||
wget ${{ matrix.url_sdk }} | ||
file_name=$(echo ${{matrix.url_sdk}} | awk -F/ '{print $NF}') | ||
mkdir sdk && tar -xJf $file_name -C ./sdk --strip-components=1 | ||
cd sdk | ||
- name: SSH connection to Actions | ||
uses: mxschmitt/[email protected] | ||
if: (github.event.inputs.ssh == 'true' && github.event.inputs.ssh != 'false') || contains(github.event.action, 'ssh') | ||
|
||
- name: ${{ matrix.platform }} feeds configuration packages | ||
run: | | ||
cd sdk | ||
echo "src-git v2raya https://github.com/${{ env.v2raya }}.git;master" >> feeds.conf.default | ||
./scripts/feeds update -a | ||
./scripts/feeds install -a -f -p v2raya | ||
./scripts/feeds install luci-app-v2raya | ||
echo "CONFIG_ALL_NONSHARED=n" > .config | ||
echo "CONFIG_ALL_KMODS=n" >> .config | ||
echo "CONFIG_ALL=n" >> .config | ||
echo "CONFIG_AUTOREMOVE=n" >> .config | ||
echo "CONFIG_PACKAGE_luci-app-v2raya=m" >> .config | ||
make defconfig | ||
- name: ${{ matrix.platform }} download | ||
run: | | ||
cd sdk | ||
make download -j8 | ||
find dl -size -1024c -exec ls -l {} \; | ||
- name: ${{ matrix.platform }} compile | ||
id: compile | ||
run: | | ||
cd sdk | ||
make package/luci-app-v2raya/{clean,compile} -j$(nproc) | ||
echo "status=success" >> $GITHUB_OUTPUT | ||
- name: Organize ${{ matrix.platform }} files | ||
id: organize | ||
if: steps.compile.outputs.status == 'success' | ||
run: | | ||
cd sdk | ||
mkdir upload | ||
zip -jr upload/v2raya_ipk_${{ matrix.platform }}.zip bin/packages/*/v2raya/ | ||
echo "FIRMWARE=$PWD" >> $GITHUB_ENV | ||
echo "status=success" >> $GITHUB_OUTPUT | ||
- name: Generate release info | ||
id: info | ||
if: steps.compile.outputs.status == 'success' | ||
run: | | ||
cd sdk | ||
echo "## :mega:Update content" >> release.txt | ||
echo "![](https://img.shields.io/github/downloads/${{ env.v2raya }}/${{needs.job_check.outputs.v2raya_version}}/total?style=flat-square)" >> release.txt | ||
echo "### v2raya Info" >> release.txt | ||
echo "**:minidisc: v2raya Version: ${{needs.job_check.outputs.v2raya_version}}**" >> release.txt | ||
echo "**:gear: OpenWrt SDK Version: 21.02.7**" >> release.txt | ||
echo "### Packages Version" >> release.txt | ||
echo "**package name**|**package version**" >> release.txt | ||
echo "-|-" >> release.txt | ||
pkgs=$(ls feeds/v2raya -I v2ray-geodata) | ||
for pkg in $pkgs; do | ||
version=$(awk -F ':=' '/PKG_VERSION:=/{print $2}' feeds/v2raya/$pkg/Makefile | sed 's/\r//g') | ||
[ -z "${version}" ] && version=$(awk -F ':=' '/PKG_SOURCE_DATE:=/{print $2}' feeds/v2raya/$pkg/Makefile | sed 's/\r//g') | ||
echo "**:ice_cube: $pkg**|**${version}**" >> release.txt | ||
done | ||
echo "**:ice_cube: v2ray-geoip**|**$(awk -F ':=' '/GEOIP_VER:=/{print $2}' feeds/v2raya/v2ray-geodata/Makefile)**" >> release.txt | ||
echo "**:ice_cube: v2ray-geosite**|**$(awk -F ':=' '/GEOSITE_VER:=/{print $2}' feeds/v2raya/v2ray-geodata/Makefile)**" >> release.txt | ||
touch release.txt | ||
echo "status=success" >> $GITHUB_OUTPUT | ||
- name: Upload firmware to release | ||
uses: softprops/action-gh-release@v1 | ||
if: steps.info.outputs.status == 'success' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{needs.job_check.outputs.v2raya_version}} | ||
body_path: ${{ env.FIRMWARE }}/release.txt | ||
files: ${{ env.FIRMWARE }}/upload/* |