mirror of
https://github.com/fw876/helloworld.git
synced 2026-12-05 08:01:07 +00:00
326 lines
12 KiB
YAML
326 lines
12 KiB
YAML
name: Release Packages
|
|
|
|
'on':
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
TZ: Asia/Shanghai
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
jobs:
|
|
prepare:
|
|
name: Prepare Release
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
tag_name: ${{ steps.release_meta.outputs.tag_name }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
path: source
|
|
|
|
- name: Generate release note
|
|
id: release_meta
|
|
run: |
|
|
tag_name="${GITHUB_REF_NAME}"
|
|
|
|
{
|
|
echo "# helloworld ${tag_name}"
|
|
echo
|
|
previous_tag="$(git -C source describe --tags --abbrev=0 "${GITHUB_SHA}^" 2>/dev/null || true)"
|
|
if [ -n "$previous_tag" ]; then
|
|
echo "Changes since ${previous_tag}:"
|
|
commit_range="${previous_tag}..${GITHUB_SHA}"
|
|
else
|
|
echo "Changes included in ${tag_name}:"
|
|
commit_range="${GITHUB_SHA}"
|
|
fi
|
|
echo
|
|
git -C source log --pretty=format:'- %s (`%h`)' "$commit_range"
|
|
echo
|
|
echo
|
|
echo "Packages:"
|
|
echo "- luci-app-ssr-plus"
|
|
echo "- xray-core"
|
|
echo "- mihomo"
|
|
echo "- luci-i18n-ssr-plus-zh-cn"
|
|
echo "- dns2tcp"
|
|
echo "- ipt2socks"
|
|
echo "- lua-neturl"
|
|
} > release_note.md
|
|
|
|
echo "tag_name=${tag_name}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Upload release note
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: release-note
|
|
path: release_note.md
|
|
|
|
build:
|
|
name: Build ${{ matrix.build_arch }}
|
|
needs: prepare
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
build_arch:
|
|
- x64_ipk
|
|
- x64_apk
|
|
- arm64_generic_ipk
|
|
- arm64_generic_apk
|
|
- arm64_a53_ipk
|
|
- arm64_a53_apk
|
|
|
|
steps:
|
|
- name: Install packages
|
|
run: |
|
|
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 rsync unzip zlib1g-dev file wget
|
|
sudo -E apt-get -qq autoremove --purge
|
|
sudo -E apt-get -qq clean
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
path: source
|
|
|
|
- name: Import environment
|
|
id: sdk_env
|
|
run: |
|
|
cat source/.github/workflows/${{ matrix.build_arch }}.env >> "$GITHUB_ENV"
|
|
while IFS='=' read -r key value; do
|
|
echo "${key,,}=${value}" >> "$GITHUB_OUTPUT"
|
|
done < source/.github/workflows/${{ matrix.build_arch }}.env
|
|
|
|
- name: Initialize SDK
|
|
env:
|
|
SDK_FILE: ${{ steps.sdk_env.outputs.sdk_name }}.${{ steps.sdk_env.outputs.sdk_ext }}
|
|
SDK_SOURCE: ${{ steps.sdk_env.outputs.sdk_url }}${{ steps.sdk_env.outputs.sdk_name }}.${{ steps.sdk_env.outputs.sdk_ext }}
|
|
run: |
|
|
wget "$SDK_SOURCE"
|
|
mkdir -p sdk
|
|
|
|
if [ "${SDK_EXT}" = "tar.zst" ]; then
|
|
tar --zstd -xf "$SDK_FILE" -C sdk --strip-components=1
|
|
else
|
|
tar -xf "$SDK_FILE" -C sdk --strip-components=1
|
|
fi
|
|
|
|
cd sdk
|
|
cat <<EOF > feeds.conf
|
|
src-git base https://github.com/openwrt/openwrt.git;${FEED_BRANCH}
|
|
src-git packages https://github.com/openwrt/packages.git;${FEED_BRANCH}
|
|
src-git luci https://github.com/openwrt/luci.git;${FEED_BRANCH}
|
|
src-git routing https://git.openwrt.org/feed/routing.git;${FEED_BRANCH}
|
|
EOF
|
|
./scripts/feeds update -a
|
|
# Use the latest Go toolchain for both IPK and APK builds.
|
|
git -C feeds/packages fetch --depth=1 origin master
|
|
rm -rf feeds/packages/lang/golang
|
|
git -C feeds/packages restore --source=FETCH_HEAD --staged --worktree -- lang/golang
|
|
rm -rf feeds/packages/net/xray-core
|
|
# These release SDKs use musl. The 25.12 metadata generator expands
|
|
# curl -> LDAP -> SASL -> glibc-only libcrypt into a Kconfig cycle.
|
|
# Drop the inapplicable dependency before regenerating feed metadata.
|
|
if [[ "${SDK_NAME}" == *_musl.* ]]; then
|
|
sed -i 's/+USE_GLIBC:libcrypt-compat//g' feeds/packages/libs/cyrus-sasl/Makefile
|
|
fi
|
|
./scripts/feeds update -i packages
|
|
echo "src-link helloworld $(pwd)/../source" >> feeds.conf
|
|
./scripts/feeds update helloworld
|
|
# Install only release packages and their dependencies. Installing all
|
|
# feeds also imports unrelated, conflicting Kconfig options into SDKs.
|
|
./scripts/feeds install -p helloworld dns2tcp ipt2socks lua-neturl luci-app-ssr-plus xray-core mihomo
|
|
test -e package/feeds/helloworld/xray-core
|
|
cat <<'EOF' > .config
|
|
CONFIG_ALL_NONSHARED=n
|
|
CONFIG_ALL_KMODS=n
|
|
CONFIG_ALL=n
|
|
CONFIG_AUTOREMOVE=n
|
|
CONFIG_LUCI_LANG_zh_Hans=y
|
|
CONFIG_PACKAGE_luci-app-ssr-plus=m
|
|
CONFIG_PACKAGE_luci-i18n-ssr-plus-zh-cn=m
|
|
CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_NONE_V2RAY=y
|
|
CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Shadowsocks_NONE_Client=y
|
|
CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Shadowsocks_NONE_Server=y
|
|
CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_ChinaDNS_NG=n
|
|
CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_DNS2TCP=n
|
|
CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_MosDNS=n
|
|
CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Http_Proxy=n
|
|
CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Mihomo=n
|
|
CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_GeoData=n
|
|
CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Shadow_TLS=n
|
|
CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Kcptun=n
|
|
CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_NaiveProxy=n
|
|
CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Shadowsocks_Rust_Client=n
|
|
CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Shadowsocks_Rust_Server=n
|
|
CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Shadowsocks_Simple_Obfs=n
|
|
CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_Shadowsocks_V2ray_Plugin=n
|
|
CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_ShadowsocksR_Libev_Client=n
|
|
CONFIG_PACKAGE_luci-app-ssr-plus_INCLUDE_ShadowsocksR_Libev_Server=n
|
|
CONFIG_PACKAGE_xray-core=m
|
|
CONFIG_XRAY_CORE_NAIVE=y
|
|
CONFIG_PACKAGE_mihomo=m
|
|
CONFIG_PACKAGE_dns2tcp=m
|
|
CONFIG_PACKAGE_ipt2socks=m
|
|
CONFIG_PACKAGE_lua-neturl=m
|
|
CONFIG_PACKAGE_naiveproxy=n
|
|
EOF
|
|
mkdir -p logs
|
|
make defconfig 2>&1 | tee logs/defconfig.log
|
|
if grep -Eq 'recursive dependency detected|error:' logs/defconfig.log; then
|
|
exit 1
|
|
fi
|
|
for option in PACKAGE_luci-app-ssr-plus PACKAGE_luci-i18n-ssr-plus-zh-cn PACKAGE_xray-core PACKAGE_mihomo PACKAGE_dns2tcp PACKAGE_ipt2socks PACKAGE_lua-neturl; do
|
|
grep -qx "CONFIG_${option}=m" .config
|
|
done
|
|
grep -qx 'CONFIG_XRAY_CORE_NAIVE=y' .config
|
|
! grep -Eq '^CONFIG_PACKAGE_naiveproxy=[ym]$' .config
|
|
|
|
- name: Compile packages
|
|
id: compile
|
|
run: |
|
|
cd sdk
|
|
test -e package/feeds/helloworld/xray-core
|
|
|
|
packages=(dns2tcp ipt2socks lua-neturl luci-app-ssr-plus xray-core mihomo)
|
|
for package in "${packages[@]}"; do
|
|
make "package/feeds/helloworld/${package}/clean" -j1 V=s
|
|
if ! make "package/feeds/helloworld/${package}/compile" -j"$(nproc)" BUILD_LOG=1 2>&1 | tee "logs/${package}.log"; then
|
|
make "package/feeds/helloworld/${package}/compile" -j1 V=s BUILD_LOG=1 2>&1 | tee "logs/${package}-retry.log"
|
|
fi
|
|
done
|
|
|
|
package_dir="$(pwd)/bin/packages/${SDK_ARCH}/helloworld"
|
|
dist_dir="$(pwd)/../dist/${{ matrix.build_arch }}"
|
|
mkdir -p "$dist_dir"
|
|
|
|
shopt -s nullglob
|
|
package_files=()
|
|
# LuCI generates translations while compiling luci-app-ssr-plus.
|
|
release_packages=("${packages[@]}" luci-i18n-ssr-plus-zh-cn)
|
|
for package in "${release_packages[@]}"; do
|
|
if [ "${PACKAGE_EXT}" = "apk" ]; then
|
|
matches=("$package_dir"/"${package}"-*.apk)
|
|
else
|
|
matches=("$package_dir"/"${package}"_*.ipk)
|
|
fi
|
|
if [ ${#matches[@]} -eq 0 ]; then
|
|
echo "No ${package} .${PACKAGE_EXT} package was produced in ${package_dir}" >&2
|
|
exit 1
|
|
fi
|
|
package_files+=("${matches[@]}")
|
|
done
|
|
|
|
for package_file in "${package_files[@]}"; do
|
|
package_name="$(basename "$package_file")"
|
|
if [ "${PACKAGE_EXT}" = "apk" ]; then
|
|
case "$package_name" in
|
|
xray-core-*.apk|mihomo-*.apk|dns2tcp-*.apk|ipt2socks-*.apk)
|
|
package_name="${package_name%.apk}_${SDK_ARCH}.apk"
|
|
;;
|
|
esac
|
|
fi
|
|
cp "$package_file" "$dist_dir/$package_name"
|
|
done
|
|
cp "$package_dir"/Packages* "$dist_dir"/ 2>/dev/null || true
|
|
cp "$package_dir"/APKINDEX* "$dist_dir"/ 2>/dev/null || true
|
|
|
|
{
|
|
echo "Tag: ${{ needs.prepare.outputs.tag_name }}"
|
|
echo "Build: ${{ matrix.build_arch }}"
|
|
echo "SDK: ${SDK_NAME}"
|
|
echo "Package format: ${PACKAGE_EXT}"
|
|
echo "Package count: ${#package_files[@]}"
|
|
} > "$dist_dir/BUILD-INFO.txt"
|
|
|
|
- name: Upload artifacts
|
|
if: success()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: helloworld-${{ matrix.build_arch }}
|
|
path: dist/${{ matrix.build_arch }}
|
|
retention-days: 7
|
|
if-no-files-found: error
|
|
|
|
- name: Upload failure logs
|
|
if: failure()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: build-logs-${{ matrix.build_arch }}
|
|
include-hidden-files: true
|
|
path: |
|
|
sdk/logs/
|
|
sdk/.config
|
|
sdk/tmp/.config-package.in
|
|
retention-days: 7
|
|
|
|
release:
|
|
name: Publish Release
|
|
needs:
|
|
- prepare
|
|
- build
|
|
if: ${{ success() && github.event_name == 'push' }}
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Download build artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts
|
|
pattern: helloworld-*
|
|
merge-multiple: false
|
|
|
|
- name: Download release note
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: release-note
|
|
path: release-note
|
|
|
|
- name: Collect release assets
|
|
run: |
|
|
mkdir -p releases
|
|
shopt -s nullglob
|
|
|
|
for arch in x64_ipk x64_apk arm64_generic_ipk arm64_generic_apk arm64_a53_ipk arm64_a53_apk; do
|
|
dir="artifacts/helloworld-${arch}"
|
|
ext="${arch##*_}"
|
|
for name in luci-app-ssr-plus luci-i18n-ssr-plus-zh-cn xray-core mihomo dns2tcp ipt2socks lua-neturl; do
|
|
if [ "$ext" = apk ]; then
|
|
matches=("$dir/$name"-*.apk)
|
|
else
|
|
matches=("$dir/$name"_*.ipk)
|
|
fi
|
|
if [ ${#matches[@]} -eq 0 ]; then
|
|
echo "Missing release package: ${arch}/${name}" >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
for package in "$dir"/*.ipk "$dir"/*.apk; do
|
|
[ -f "$package" ] || continue
|
|
cp "$package" releases/
|
|
done
|
|
done
|
|
|
|
ls -lh releases
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v2.2.2
|
|
with:
|
|
tag_name: ${{ needs.prepare.outputs.tag_name }}
|
|
body_path: release-note/release_note.md
|
|
prerelease: ${{ contains(needs.prepare.outputs.tag_name, '-beta') || contains(needs.prepare.outputs.tag_name, '-rc') }}
|
|
files: releases/*
|
|
fail_on_unmatched_files: true
|