tag v1.8.16 #59
Workflow file for this run
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
name: Build and Release | |
on: | |
push: | |
tags: | |
- '*' | |
workflow_dispatch: | |
env: | |
PACKAGE_NAME: xray-core | |
CACHE_DIR: ~/cache | |
jobs: | |
release: | |
name: Build for ${{ matrix.arch }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- arch: aarch64_cortex-a53 | |
sdk_url_path: https://downloads.openwrt.org/snapshots/targets/bcm27xx/bcm2710 | |
sdk_name: -sdk-bcm27xx-bcm2710_ | |
- arch: aarch64_cortex-a72 | |
sdk_url_path: https://downloads.openwrt.org/snapshots/targets/mvebu/cortexa72 | |
sdk_name: -sdk-mvebu-cortexa72_ | |
- arch: aarch64_generic | |
sdk_url_path: http://downloads.openwrt.org/snapshots/targets/layerscape/armv8_64b | |
sdk_name: -sdk-layerscape-armv8_64b_ | |
- arch: arm_arm1176jzf-s_vfp | |
sdk_url_path: https://downloads.openwrt.org/snapshots/targets/bcm27xx/bcm2708 | |
sdk_name: -sdk-bcm27xx-bcm2708_ | |
- arch: arm_cortex-a15_neon-vfpv4 | |
sdk_url_path: https://downloads.openwrt.org/snapshots/targets/ipq806x/generic | |
sdk_name: -sdk-ipq806x-generic_ | |
- arch: arm_cortex-a5-vfpv4 | |
sdk_url_path: https://downloads.openwrt.org/snapshots/targets/at91/sama5 | |
sdk_name: -sdk-at91-sama5_ | |
- arch: arm_cortex-a7_neon-vfpv4 | |
sdk_url_path: https://downloads.openwrt.org/snapshots/targets/bcm27xx/bcm2709 | |
sdk_name: -sdk-bcm27xx-bcm2709_ | |
- arch: arm_cortex-a8_vfpv3 | |
sdk_url_path: https://downloads.openwrt.org/snapshots/targets/sunxi/cortexa8 | |
sdk_name: -sdk-sunxi-cortexa8_ | |
- arch: arm_cortex-a9 | |
sdk_url_path: https://downloads.openwrt.org/snapshots/targets/bcm53xx/generic | |
sdk_name: -sdk-bcm53xx-generic_ | |
- arch: arm_cortex-a9_vfpv3-d16 | |
sdk_url_path: https://downloads.openwrt.org/snapshots/targets/mvebu/cortexa9 | |
sdk_name: -sdk-mvebu-cortexa9_ | |
- arch: arm_mpcore | |
sdk_url_path: https://downloads.openwrt.org/snapshots/targets/oxnas/ox820 | |
sdk_name: -sdk-oxnas-ox820_ | |
- arch: i386_pentium | |
sdk_url_path: https://downloads.openwrt.org/snapshots/targets/x86/legacy | |
sdk_name: -sdk-x86-legacy_ | |
- arch: i386_pentium4 | |
sdk_url_path: https://downloads.openwrt.org/snapshots/targets/x86/generic | |
sdk_name: -sdk-x86-generic_ | |
- arch: mipsel_24kc | |
sdk_url_path: https://downloads.openwrt.org/snapshots/targets/ramips/mt7620 | |
sdk_name: -sdk-ramips-mt7620_ | |
- arch: mipsel_74kc | |
sdk_url_path: https://downloads.openwrt.org/snapshots/targets/bcm47xx/mips74k | |
sdk_name: -sdk-bcm47xx-mips74k_ | |
- arch: mipsel_mips32 | |
sdk_url_path: https://downloads.openwrt.org/snapshots/targets/bcm47xx/generic | |
sdk_name: -sdk-bcm47xx-generic_ | |
- arch: mips_24kc | |
sdk_url_path: https://downloads.openwrt.org/snapshots/targets/ath79/generic | |
sdk_name: -sdk-ath79-generic_ | |
- arch: mips_mips32 | |
sdk_url_path: https://downloads.openwrt.org/snapshots/targets/bcm63xx/generic | |
sdk_name: -sdk-bcm63xx-generic_ | |
- arch: x86_64 | |
sdk_url_path: https://downloads.openwrt.org/snapshots/targets/x86/64 | |
sdk_name: -sdk-x86-64_ | |
env: | |
SDK_URL_PATH: ${{ matrix.sdk_url_path }} | |
SDK_NAME: ${{ matrix.sdk_name }} | |
CCACHE_DIR: ~/.ccache | |
CONFIG_CCACHE: y | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Prepare Cache Key | |
id: cache_key | |
run: echo "::set-output name=timestamp::$(date +"%s")" | |
- name: Setup Cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
${{ env.CACHE_DIR }} | |
${{ env.CCACHE_DIR }} | |
key: openwrt-${{ matrix.arch }}-${{ env.PACKAGE_NAME }}-${{ steps.cache_key.outputs.timestamp }} | |
restore-keys: | | |
openwrt-${{ matrix.arch }}-${{ env.PACKAGE_NAME }}- | |
- name: Install Dependencies | |
run: | | |
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y ccache gettext libncurses5-dev xsltproc | |
- name: Create Directories | |
run: | | |
CACHE_DIR_SDK="$(eval echo "$CACHE_DIR/sdk")" | |
CACHE_DIR_DL="$(eval echo "$CACHE_DIR/dl")" | |
CACHE_DIR_FEEDS="$(eval echo "$CACHE_DIR/feeds")" | |
echo "CACHE_DIR_SDK: $CACHE_DIR_SDK" | |
echo "CACHE_DIR_DL: $CACHE_DIR_DL" | |
echo "CACHE_DIR_FEEDS: $CACHE_DIR_FEEDS" | |
test -d "$CACHE_DIR_SDK" || mkdir -p "$CACHE_DIR_SDK" | |
test -d "$CACHE_DIR_DL" || mkdir -p "$CACHE_DIR_DL" | |
test -d "$CACHE_DIR_FEEDS" || mkdir -p "$CACHE_DIR_FEEDS" | |
echo "CACHE_DIR_SDK=$CACHE_DIR_SDK" >> $GITHUB_ENV | |
echo "CACHE_DIR_DL=$CACHE_DIR_DL" >> $GITHUB_ENV | |
echo "CACHE_DIR_FEEDS=$CACHE_DIR_FEEDS" >> $GITHUB_ENV | |
echo "SDK_HOME=$(mktemp -d)" >> $GITHUB_ENV | |
- name: Download and Unzip SDK | |
run: | | |
cd "$CACHE_DIR_SDK" | |
if ! ( wget -q -O - "$SDK_URL_PATH/sha256sums" | grep -- "$SDK_NAME" > sha256sums.small 2>/dev/null ) ; then | |
echo "::error::Can not find ${SDK_NAME} file in sha256sums." | |
exit 1 | |
fi | |
SDK_FILE="$(cat sha256sums.small | cut -d' ' -f2 | sed 's/*//g')" | |
if ! sha256sum -c ./sha256sums.small >/dev/null 2>&1 ; then | |
wget -q -O "$SDK_FILE" "$SDK_URL_PATH/$SDK_FILE" | |
if ! sha256sum -c ./sha256sums.small >/dev/null 2>&1 ; then | |
echo "::error::SDK can not be verified!" | |
exit 1 | |
fi | |
fi | |
cd - | |
file "$CACHE_DIR_SDK/$SDK_FILE" | |
tar -I zstd -xvf "$CACHE_DIR_SDK/$SDK_FILE" -C "$SDK_HOME" --strip=1 | |
cd "$SDK_HOME" | |
test -d "dl" && rm -rf "dl" || true | |
test -d "feeds" && rm -rf "feeds" || true | |
ln -s "$CACHE_DIR_DL" "dl" | |
ln -s "$CACHE_DIR_FEEDS" "feeds" | |
cp feeds.conf.default feeds.conf | |
sed -i 's#git.openwrt.org/openwrt/openwrt#github.com/openwrt/openwrt#' feeds.conf | |
sed -i 's#git.openwrt.org/feed/packages#github.com/openwrt/packages#' feeds.conf | |
sed -i 's#git.openwrt.org/project/luci#github.com/openwrt/luci#' feeds.conf | |
sed -i 's#git.openwrt.org/feed/telephony#github.com/openwrt/telephony#' feeds.conf | |
cd - | |
- name: Update and Install Packages | |
env: | |
OPENWRT_GOLANG_COMMIT: ${{ secrets.OPENWRT_GOLANG_COMMIT }} | |
run: | | |
cd "$SDK_HOME" | |
./scripts/feeds update -a | |
test -d "feeds/packages/net/$PACKAGE_NAME" && rm -rf "feeds/packages/net/$PACKAGE_NAME" || true | |
test -d "feeds/packages/lang/golang" && rm -rf "feeds/packages/lang/golang" || true | |
curl https://codeload.github.com/openwrt/packages/tar.gz/${OPENWRT_GOLANG_COMMIT:-master} | tar -xz -C "feeds/packages/lang" --strip=2 packages-${OPENWRT_GOLANG_COMMIT:-master}/lang/golang | |
ln -s "${{ github.workspace }}" "package/$PACKAGE_NAME" | |
./scripts/feeds install -a | |
cd - | |
- name: Build Packages | |
run: | | |
cd "$SDK_HOME" | |
make defconfig | |
make package/${PACKAGE_NAME}/{clean,compile} V=s | |
find "$SDK_HOME/bin/" -type f -name "*.ipk" -exec ls -lh {} \; | |
cd - | |
- name: Copy Bin Files | |
run: | | |
find "$SDK_HOME/bin/" -type f -name "*xray*.ipk" -exec cp {} "${{ github.workspace }}" \; | |
find "${{ github.workspace }}" -type f -name "*.ipk" -exec ls -lh {} \; | |
- name: Release and Upload Assets | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: '*.ipk' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
notify: | |
name: Notify Release Publish | |
runs-on: ubuntu-latest | |
env: | |
TRIGGER_URL: ${{ secrets.TRIGGER_URL }} | |
TRIGGER_TOKEN: ${{ secrets.TRIGGER_TOKEN }} | |
needs: release | |
steps: | |
- name: Notify Jenkins | |
run: | | |
if [ -z "$TRIGGER_URL" ] ; then | |
echo "::warning::No trigger url found, skip..." | |
exit 0 | |
fi | |
curl -X POST \ | |
-H "Content-Type: application/json; charset=utf-8" \ | |
-H "Authorization: Bearer $TRIGGER_TOKEN" \ | |
-d "{\"event\":\"release\",\"repository\":\"${{ github.repository }}\",\"ref\":\"${{ github.ref }}\"}" \ | |
"$TRIGGER_URL" || true |