mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-05-10 04:01:25 +03:00
Workflows: Ensure Geodat exists (#4680)
This commit is contained in:
parent
0d0fe7ef7a
commit
f0dfbc2e66
31
.github/workflows/release-win7.yml
vendored
31
.github/workflows/release-win7.yml
vendored
@ -9,7 +9,38 @@ on:
|
|||||||
types: [opened, synchronize, reopened]
|
types: [opened, synchronize, reopened]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
check-assets:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Restore Geodat Cache
|
||||||
|
uses: actions/cache/restore@v4
|
||||||
|
with:
|
||||||
|
path: resources
|
||||||
|
key: xray-geodat-
|
||||||
|
|
||||||
|
- name: Check Assets Existence
|
||||||
|
id: check-assets
|
||||||
|
run: |
|
||||||
|
[ -d 'resources' ] || mkdir resources
|
||||||
|
LIST=('geoip.dat' 'geosite.dat')
|
||||||
|
for FILE_NAME in "${LIST[@]}"
|
||||||
|
do
|
||||||
|
echo -e "Checking ${FILE_NAME}..."
|
||||||
|
if [ -s "./resources/${FILE_NAME}" ]; then
|
||||||
|
echo -e "${FILE_NAME} exists."
|
||||||
|
else
|
||||||
|
echo -e "${FILE_NAME} does not exist."
|
||||||
|
echo "missing=true" >> $GITHUB_OUTPUT
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Sleep for 90 seconds if Assets Missing
|
||||||
|
if: steps.check-assets.outputs.missing == 'true'
|
||||||
|
run: sleep 90
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
needs: check-assets
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
strategy:
|
strategy:
|
||||||
|
46
.github/workflows/release.yml
vendored
46
.github/workflows/release.yml
vendored
@ -9,7 +9,53 @@ on:
|
|||||||
types: [opened, synchronize, reopened]
|
types: [opened, synchronize, reopened]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
check-assets:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Restore Geodat Cache
|
||||||
|
uses: actions/cache/restore@v4
|
||||||
|
with:
|
||||||
|
path: resources
|
||||||
|
key: xray-geodat-
|
||||||
|
|
||||||
|
- name: Check Assets Existence
|
||||||
|
id: check-assets
|
||||||
|
run: |
|
||||||
|
[ -d 'resources' ] || mkdir resources
|
||||||
|
LIST=('geoip.dat' 'geosite.dat')
|
||||||
|
for FILE_NAME in "${LIST[@]}"
|
||||||
|
do
|
||||||
|
echo -e "Checking ${FILE_NAME}..."
|
||||||
|
if [ -s "./resources/${FILE_NAME}" ]; then
|
||||||
|
echo -e "${FILE_NAME} exists."
|
||||||
|
else
|
||||||
|
echo -e "${FILE_NAME} does not exist."
|
||||||
|
echo "missing=true" >> $GITHUB_OUTPUT
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Trigger Asset Update Workflow if Assets Missing
|
||||||
|
if: steps.check-assets.outputs.missing == 'true'
|
||||||
|
uses: actions/github-script@v6
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
script: |
|
||||||
|
const { owner, repo } = context.repo;
|
||||||
|
await github.rest.actions.createWorkflowDispatch({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
workflow_id: 'scheduled-assets-update.yml',
|
||||||
|
ref: context.ref
|
||||||
|
});
|
||||||
|
console.log('Triggered scheduled-assets-update.yml due to missing assets on branch:', context.ref);
|
||||||
|
|
||||||
|
- name: Sleep for 90 seconds if Assets Missing
|
||||||
|
if: steps.check-assets.outputs.missing == 'true'
|
||||||
|
run: sleep 90
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
needs: check-assets
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
strategy:
|
strategy:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: Scheduled assets update
|
name: Scheduled assets update
|
||||||
|
|
||||||
# NOTE: This Github Actions is required by other actions, for preparing other packaging assets in a
|
# NOTE: This Github Actions is required by other actions, for preparing other packaging assets in a
|
||||||
# routine manner, for example: GeoIP/GeoSite.
|
# routine manner, for example: GeoIP/GeoSite.
|
||||||
# Currently updating:
|
# Currently updating:
|
||||||
# - Geodat (GeoIP/Geosite)
|
# - Geodat (GeoIP/Geosite)
|
||||||
@ -9,7 +9,7 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
# Update GeoData on every day (22:30 UTC)
|
# Update GeoData on every day (22:30 UTC)
|
||||||
- cron: '30 22 * * *'
|
- cron: "30 22 * * *"
|
||||||
push:
|
push:
|
||||||
# Prevent triggering update request storm
|
# Prevent triggering update request storm
|
||||||
paths:
|
paths:
|
||||||
|
29
.github/workflows/test.yml
vendored
29
.github/workflows/test.yml
vendored
@ -6,7 +6,36 @@ on:
|
|||||||
types: [opened, synchronize, reopened]
|
types: [opened, synchronize, reopened]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
check-assets:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Restore Geodat Cache
|
||||||
|
uses: actions/cache/restore@v4
|
||||||
|
with:
|
||||||
|
path: resources
|
||||||
|
key: xray-geodat-
|
||||||
|
- name: Check Assets Existence
|
||||||
|
id: check-assets
|
||||||
|
run: |
|
||||||
|
[ -d 'resources' ] || mkdir resources
|
||||||
|
LIST=('geoip.dat' 'geosite.dat')
|
||||||
|
for FILE_NAME in "${LIST[@]}"
|
||||||
|
do
|
||||||
|
echo -e "Checking ${FILE_NAME}..."
|
||||||
|
if [ -s "./resources/${FILE_NAME}" ]; then
|
||||||
|
echo -e "${FILE_NAME} exists."
|
||||||
|
else
|
||||||
|
echo -e "${FILE_NAME} does not exist."
|
||||||
|
echo "missing=true" >> $GITHUB_OUTPUT
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
- name: Sleep for 90 seconds if Assets Missing
|
||||||
|
if: steps.check-assets.outputs.missing == 'true'
|
||||||
|
run: sleep 90
|
||||||
|
|
||||||
test:
|
test:
|
||||||
|
needs: check-assets
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user