Update update-dependencies.yml

This commit is contained in:
civisrom 2025-03-04 14:41:11 +03:00 committed by GitHub
parent bfc4a7ea16
commit c13e4f12ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,33 +1,27 @@
name: Update Go Dependencies name: Update Go Dependencies
on: on:
schedule: schedule:
- cron: '0 0 * * 1' # Запуск каждую неделю в понедельник в 00:00 UTC - cron: '0 0 * * 1' # Запуск каждую неделю в понедельник в 00:00 UTC
workflow_dispatch: # Возможность ручного запуска workflow_dispatch: # Возможность ручного запуска
permissions: permissions:
contents: write # Явное указание разрешений contents: write # Явное указание разрешений
jobs: jobs:
update: update:
runs-on: ubuntu-latest # Используем последнюю версию Ubuntu runs-on: ubuntu-latest # Используем последнюю версию Ubuntu
timeout-minutes: 30 # Добавляем таймаут для предотвращения зависания timeout-minutes: 30 # Добавляем таймаут для предотвращения зависания
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 0 # Загружаем всю историю fetch-depth: 0 # Загружаем всю историю
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Go - name: Setup Go
uses: actions/setup-go@v5 uses: actions/setup-go@v5
with: with:
go-version-file: go.mod go-version-file: go.mod
check-latest: true check-latest: true
cache: true # Включаем кэширование модулей cache: true # Включаем кэширование модулей
- name: Check go.mod and go.sum exist - name: Check go.mod and go.sum exist
run: | run: |
if [ ! -f go.mod ]; then if [ ! -f go.mod ]; then
@ -40,12 +34,10 @@ jobs:
echo "go.sum file not found, initializing it..." echo "go.sum file not found, initializing it..."
go mod tidy go mod tidy
fi fi
- name: Clean Go module cache - name: Clean Go module cache
run: | run: |
go clean -modcache go clean -modcache
go clean -cache go clean -cache
- name: Update dependencies - name: Update dependencies
id: update id: update
run: | run: |
@ -59,8 +51,13 @@ jobs:
grep -v 'github.com/xtls/xray-core' | \ grep -v 'github.com/xtls/xray-core' | \
xargs -r go get -u xargs -r go get -u
echo "Specifically updating xray-core to latest commit..." echo "Specifically updating xray-core to latest release..."
go get github.com/xtls/xray-core@main # Получаем последний тег релиза
LATEST_RELEASE=$(curl -s https://api.github.com/repos/xtls/xray-core/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
# Обновляем xray-core до последнего тега релиза
go get github.com/xtls/xray-core@$LATEST_RELEASE
# Проверяем, какую версию получили # Проверяем, какую версию получили
echo "Updated xray-core to:" echo "Updated xray-core to:"
go list -m github.com/xtls/xray-core go list -m github.com/xtls/xray-core
@ -72,7 +69,6 @@ jobs:
# Выводим изменения для лога # Выводим изменения для лога
echo "Updated dependencies:" echo "Updated dependencies:"
go list -m all go list -m all
- name: Check for changes - name: Check for changes
id: check id: check
run: | run: |
@ -85,7 +81,6 @@ jobs:
# Добавляем || true чтобы предотвратить код ошибки, если grep ничего не находит # Добавляем || true чтобы предотвратить код ошибки, если grep ничего не находит
git diff go.mod || true git diff go.mod || true
fi fi
- name: Commit and push changes - name: Commit and push changes
if: steps.check.outputs.changes == 'true' if: steps.check.outputs.changes == 'true'
run: | run: |