Refactor frontend (#55) #24
This file contains 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: Frontend CI workflow | |
on: | |
push: | |
paths: | |
- "frontend/**" | |
- ".github/workflows/frontend.yaml" | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./frontend | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Use Node.js 20.x and cache dependencies | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20.x | |
cache: 'npm' | |
cache-dependency-path: '**/package-lock.json' | |
- run: npm ci | |
- run: npm run build | |
build-container: | |
if: github.ref == 'refs/heads/main' | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./frontend | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Login to Yandex Cloud Container Registry | |
id: login-cr | |
uses: yc-actions/yc-cr-login@v2 | |
with: | |
yc-sa-json-credentials: ${{ secrets.YANDEX_SA_KEY }} | |
- run: | | |
echo "Packaging docker image ..." | |
tag="${DOCKER_REGISTRY}/app:${{ github.sha }}" | |
docker build -t $tag -t ${DOCKER_REGISTRY}/app:latest . | |
docker push ${DOCKER_REGISTRY}/app --all-tags | |
env: | |
NEXT_PUBLIC_API_URL: https://api.afana-propdoc.ru | |
DOCKER_REGISTRY: cr.yandex/crpc50gkvq2bp251sfgb |