From c13e4f12ce9fc94604714a13a309ebeee50ef337 Mon Sep 17 00:00:00 2001 From: civisrom <167646351+civisrom@users.noreply.github.com> Date: Tue, 4 Mar 2025 14:41:11 +0300 Subject: [PATCH] Update update-dependencies.yml --- .github/workflows/update-dependencies.yml | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml index edfb8fa5..7df9cb04 100644 --- a/.github/workflows/update-dependencies.yml +++ b/.github/workflows/update-dependencies.yml @@ -1,33 +1,27 @@ 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 @@ -40,12 +34,10 @@ 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: | @@ -59,12 +51,17 @@ jobs: grep -v 'github.com/xtls/xray-core' | \ xargs -r go get -u - echo "Specifically updating xray-core to latest commit..." - go get github.com/xtls/xray-core@main + 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@$LATEST_RELEASE + # Проверяем, какую версию получили echo "Updated xray-core to:" go list -m github.com/xtls/xray-core - + # Очистка и проверка go mod tidy go mod verify || exit 1 @@ -72,7 +69,6 @@ jobs: # Выводим изменения для лога echo "Updated dependencies:" go list -m all - - name: Check for changes id: check run: | @@ -85,7 +81,6 @@ jobs: # Добавляем || true чтобы предотвратить код ошибки, если grep ничего не находит git diff go.mod || true fi - - name: Commit and push changes if: steps.check.outputs.changes == 'true' run: |