Auto Update & Deploy Goida VPN Site #2117
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Auto Update & Deploy Goida VPN Site | |
| on: | |
| push: | |
| branches: ["main"] | |
| schedule: | |
| - cron: "0 * * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: build-and-deploy | |
| cancel-in-progress: true | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3.x | |
| cache: pip | |
| cache-dependency-path: source/requirements.txt | |
| - name: Set up Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| cache-dependency-path: source/package.json | |
| # Кэш внешних фронтенд-ассетов (Alpine, FontAwesome, флаги), которые | |
| # build.py скачивает с CDN каждый запуск. Ключ зависит от build.py, | |
| # поэтому при смене версий/URL ассеты обновятся. | |
| - name: Cache downloaded external assets | |
| uses: actions/cache@v5.1.0 | |
| with: | |
| path: | | |
| source/app/static/js/alpine.min.js | |
| source/app/static/js/alpine-collapse.min.js | |
| source/app/static/js/tailwind.min.js | |
| source/app/static/css/all.min.css | |
| source/app/static/webfonts | |
| source/app/static/images/flags | |
| key: external-assets-${{ hashFiles('source/build.py') }} | |
| # Кэш API-данных, которые build.py получает из GitHub API и comss.ru. | |
| # Это позволяет пропускать сетевые запросы между запусками, если TTL | |
| # кэша ещё не истёк (download links / VC runtime — 24 ч, stats — 1 ч). | |
| - name: Cache API data | |
| uses: actions/cache@v5.1.0 | |
| with: | |
| path: | | |
| source/download_links_cache.json | |
| source/vc_runtime_link_cache.json | |
| source/github_stats_cache.json | |
| key: api-data-${{ hashFiles('source/build.py', 'source/app/services/*.py') }} | |
| - name: Install dependencies | |
| run: pip install -r source/requirements.txt | |
| - name: Build Tailwind CSS | |
| working-directory: ./source | |
| run: | | |
| npm install | |
| npm run build:css | |
| - name: Build and deploy site | |
| working-directory: ./source | |
| env: | |
| MY_TOKEN: ${{ secrets.MY_TOKEN }} | |
| GITHUB_TOKEN: ${{ github.token }} | |
| GA_ID: ${{ secrets.GA_ID || vars.GA_ID }} | |
| YM_ID: ${{ secrets.YM_ID || vars.YM_ID }} | |
| YANDEX_AUTOPLACEMENT_ID: ${{ secrets.YANDEX_AUTOPLACEMENT_ID || vars.YANDEX_AUTOPLACEMENT_ID }} | |
| run: python build.py --deploy |