|
| 1 | +# Simple workflow for deploying static content to GitHub Pages |
| 2 | +name: Deploy static content to Pages |
| 3 | + |
| 4 | +on: |
| 5 | + # Runs on pushes targeting the default branch |
| 6 | + push: |
| 7 | + branches: ['master'] |
| 8 | + |
| 9 | + # Allows you to run this workflow manually from the Actions tab |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 13 | +permissions: |
| 14 | + contents: read |
| 15 | + pages: write |
| 16 | + id-token: write |
| 17 | + |
| 18 | +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
| 19 | +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
| 20 | +concurrency: |
| 21 | + group: 'pages' |
| 22 | + cancel-in-progress: false |
| 23 | + |
| 24 | +env: |
| 25 | + BUILD_SCRIPT: yarn stand:build |
| 26 | + BUILD_SCRIPT_OUTPUT: build |
| 27 | + APP_NAME: portal |
| 28 | + |
| 29 | +jobs: |
| 30 | + # Single deploy job since we're just deploying |
| 31 | + deploy: |
| 32 | + environment: |
| 33 | + name: github-pages |
| 34 | + url: ${{ steps.deployment.outputs.page_url }} |
| 35 | + runs-on: ubuntu-latest |
| 36 | + steps: |
| 37 | + # Делаем checkout текущей ветки |
| 38 | + - uses: actions/checkout@master |
| 39 | + # Устанавливаем Node.JS для сборки приложения |
| 40 | + - uses: actions/setup-node@v1 |
| 41 | + with: |
| 42 | + node-version: 22 |
| 43 | + - name: Install yarn |
| 44 | + id: yarn-setup |
| 45 | + run: | |
| 46 | + yarn policies set-version 1.22.18 |
| 47 | + echo "::set-output name=cache_dir::$(yarn cache dir)" |
| 48 | +
|
| 49 | + - name: Настройка кэширования yarn |
| 50 | + uses: actions/cache@v4 |
| 51 | + with: |
| 52 | + path: ${{ steps.yarn-setup.outputs.cache_dir }} |
| 53 | + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
| 54 | + restore-keys: | |
| 55 | + ${{ runner.os }}-yarn- |
| 56 | +
|
| 57 | + - name: Install dependencies |
| 58 | + run: yarn add "install-peers-cli@https://github.com/evless/install-peers-cli#fix-yarn-policies" && yarn --frozen-lockfile |
| 59 | + |
| 60 | + - name: Build App |
| 61 | + run: $BUILD_SCRIPT |
| 62 | + |
| 63 | + - name: Setup Pages |
| 64 | + uses: actions/configure-pages@v5 |
| 65 | + - name: Upload artifact |
| 66 | + uses: actions/upload-pages-artifact@v3 |
| 67 | + with: |
| 68 | + # Upload entire repository |
| 69 | + path: './$BUILD_SCRIPT_OUTPUT' |
| 70 | + - name: Deploy to GitHub Pages |
| 71 | + id: deployment |
| 72 | + uses: actions/deploy-pages@v4 |
0 commit comments