Update update-dependencies.yml

This commit is contained in:
civisrom 2025-03-04 14:37:37 +03:00 committed by GitHub
parent 0e5b94f745
commit ffb65f20e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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