Skip to content

chore: fix backend deployment action #74

chore: fix backend deployment action

chore: fix backend deployment action #74

Workflow file for this run

name: Frontend workflow
on:
push:
paths:
- 'frontend/**'
- '.github/workflows/frontend.yml'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
working-directory: ./frontend
permissions:
contents: write
jobs:
lint:
name: Lint with eslint
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version-file: 'frontend/.nvmrc'
cache: 'yarn'
cache-dependency-path: frontend/yarn.lock
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Lint with eslint
run: yarn lint
types:
name: Check types
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version-file: 'frontend/.nvmrc'
cache: 'yarn'
cache-dependency-path: frontend/yarn.lock
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Check types with tsc
run: yarn check-types
test:
name: Test with jest
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version-file: 'frontend/.nvmrc'
cache: 'yarn'
cache-dependency-path: frontend/yarn.lock
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Test with jest
run: yarn test
build:
name: Build
runs-on: ubuntu-22.04
env:
REACT_APP_API_HOST: ${{secrets.API_HOST}}
REACT_APP_VK_APP_URL: https://vk.com/app7717529
REACT_APP_SENTRY_DSN: ${{secrets.SENTRY_DSN}}
REACT_APP_VK_PIXEL_ID: ${{secrets.VK_PIXEL_ID}}
REACT_APP_MIXPANEL_ID: ${{secrets.MIXPANEL_ID}}
REACT_APP_MIXPANEL_PROXY_HOST: ${{secrets.MIXPANEL_PROXY_HOST}}
REACT_APP_SPLIT_KEY: ${{secrets.SPLIT_KEY}}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version-file: 'frontend/.nvmrc'
cache: 'yarn'
cache-dependency-path: frontend/yarn.lock
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build production
run: yarn build
- name: Save build
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: build
path: frontend/build
if-no-files-found: error
retention-days: 1
deploy:
name: Deploy prod
runs-on: ubuntu-22.04
if: github.ref == 'refs/heads/main'
needs: [lint, types, test, build]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Wait for E2E tests to succeed
uses: lewagon/wait-on-check-action@v1.2.0
with:
ref: ${{ github.ref }}
check-name: 'Run E2E tests'
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10
- name: Download build
uses: actions/download-artifact@v3
with:
name: build
path: frontend/build
- name: Deploy production
uses: JamesIves/github-pages-deploy-action@v4.4.1
with:
branch: gh-pages
folder: frontend/build
clean: true