|
|
@ -20,7 +20,51 @@ on:
|
|
|
|
- "go.sum"
|
|
|
|
- "go.sum"
|
|
|
|
- ".github/workflows/*.yml"
|
|
|
|
- ".github/workflows/*.yml"
|
|
|
|
jobs:
|
|
|
|
jobs:
|
|
|
|
|
|
|
|
prepare:
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: Restore Cache
|
|
|
|
|
|
|
|
uses: actions/cache/restore@v3
|
|
|
|
|
|
|
|
with:
|
|
|
|
|
|
|
|
path: resources
|
|
|
|
|
|
|
|
key: xray-geodat-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Update Geodat
|
|
|
|
|
|
|
|
id: update
|
|
|
|
|
|
|
|
uses: nick-fields/retry@v2
|
|
|
|
|
|
|
|
with:
|
|
|
|
|
|
|
|
timeout_minutes: 60
|
|
|
|
|
|
|
|
retry_wait_seconds: 60
|
|
|
|
|
|
|
|
max_attempts: 60
|
|
|
|
|
|
|
|
command: |
|
|
|
|
|
|
|
|
[ -d 'resources' ] || mkdir resources
|
|
|
|
|
|
|
|
LIST=('geoip geoip geoip' 'domain-list-community dlc geosite')
|
|
|
|
|
|
|
|
for i in "${LIST[@]}"
|
|
|
|
|
|
|
|
do
|
|
|
|
|
|
|
|
INFO=($(echo $i | awk 'BEGIN{FS=" ";OFS=" "} {print $1,$2,$3}'))
|
|
|
|
|
|
|
|
FILE_NAME="${INFO[2]}.dat"
|
|
|
|
|
|
|
|
echo -e "Verifying HASH key..."
|
|
|
|
|
|
|
|
HASH="$(curl -sL "https://raw.githubusercontent.com/v2fly/${INFO[0]}/release/${INFO[1]}.dat.sha256sum" | awk -F ' ' '{print $1}')"
|
|
|
|
|
|
|
|
if [ -s "./resources/${FILE_NAME}" ] && [ "$(sha256sum "./resources/${FILE_NAME}" | awk -F ' ' '{print $1}')" == "${HASH}" ]; then
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
echo -e "Downloading https://raw.githubusercontent.com/v2fly/${INFO[0]}/release/${INFO[1]}.dat..."
|
|
|
|
|
|
|
|
curl -L "https://raw.githubusercontent.com/v2fly/${INFO[0]}/release/${INFO[1]}.dat" -o ./resources/${FILE_NAME}
|
|
|
|
|
|
|
|
echo -e "Verifying HASH key..."
|
|
|
|
|
|
|
|
[ "$(sha256sum "./resources/${FILE_NAME}" | awk -F ' ' '{print $1}')" == "${HASH}" ] || { echo -e "The HASH key of ${FILE_NAME} does not match cloud one."; exit 1; }
|
|
|
|
|
|
|
|
echo "unhit=true" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Save Cache
|
|
|
|
|
|
|
|
uses: actions/cache/save@v3
|
|
|
|
|
|
|
|
if: ${{ steps.update.outputs.unhit }}
|
|
|
|
|
|
|
|
with:
|
|
|
|
|
|
|
|
path: resources
|
|
|
|
|
|
|
|
key: xray-geodat-${{ github.sha }}-${{ github.run_number }}
|
|
|
|
|
|
|
|
|
|
|
|
build:
|
|
|
|
build:
|
|
|
|
|
|
|
|
needs: prepare
|
|
|
|
permissions:
|
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
contents: write
|
|
|
|
strategy:
|
|
|
|
strategy:
|
|
|
@ -160,26 +204,17 @@ jobs:
|
|
|
|
cd ./build_assets || exit 1
|
|
|
|
cd ./build_assets || exit 1
|
|
|
|
mv xray xray.exe
|
|
|
|
mv xray xray.exe
|
|
|
|
|
|
|
|
|
|
|
|
- name: Prepare to release
|
|
|
|
- name: Restore Cache
|
|
|
|
uses: nick-fields/retry@v2
|
|
|
|
uses: actions/cache/restore@v3
|
|
|
|
with:
|
|
|
|
with:
|
|
|
|
timeout_minutes: 60
|
|
|
|
path: resources
|
|
|
|
retry_wait_seconds: 60
|
|
|
|
key: xray-geodat-
|
|
|
|
max_attempts: 60
|
|
|
|
|
|
|
|
command: |
|
|
|
|
- name: Copy README.md & LICENSE
|
|
|
|
cp ${GITHUB_WORKSPACE}/README.md ./build_assets/README.md
|
|
|
|
run: |
|
|
|
|
cp ${GITHUB_WORKSPACE}/LICENSE ./build_assets/LICENSE
|
|
|
|
mv -f resources/* build_assets
|
|
|
|
LIST=('geoip geoip geoip' 'domain-list-community dlc geosite')
|
|
|
|
cp ${GITHUB_WORKSPACE}/README.md ./build_assets/README.md
|
|
|
|
for i in "${LIST[@]}"
|
|
|
|
cp ${GITHUB_WORKSPACE}/LICENSE ./build_assets/LICENSE
|
|
|
|
do
|
|
|
|
|
|
|
|
INFO=($(echo $i | awk 'BEGIN{FS=" ";OFS=" "} {print $1,$2,$3}'))
|
|
|
|
|
|
|
|
FILE_NAME="${INFO[2]}.dat"
|
|
|
|
|
|
|
|
echo -e "Downloading https://raw.githubusercontent.com/v2fly/${INFO[0]}/release/${INFO[1]}.dat..."
|
|
|
|
|
|
|
|
curl -L "https://raw.githubusercontent.com/v2fly/${INFO[0]}/release/${INFO[1]}.dat" -o ./build_assets/${FILE_NAME}
|
|
|
|
|
|
|
|
echo -e "Verifying HASH key..."
|
|
|
|
|
|
|
|
HASH="$(curl -sL "https://raw.githubusercontent.com/v2fly/${INFO[0]}/release/${INFO[1]}.dat.sha256sum" | awk -F ' ' '{print $1}')"
|
|
|
|
|
|
|
|
[ "$(sha256sum "./build_assets/${FILE_NAME}" | awk -F ' ' '{print $1}')" == "${HASH}" ] || { echo -e "The HASH key of ${FILE_NAME} does not match cloud one."; exit 1; }
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Create ZIP archive
|
|
|
|
- name: Create ZIP archive
|
|
|
|
shell: bash
|
|
|
|
shell: bash
|
|
|
|