feat(web): replace grandmother image; #32
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: CI | |
on: | |
pull_request: | |
branches: | |
- dev | |
push: | |
branches: | |
- '**' | |
tags: | |
- 'v*' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Use Node.js 18.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: cache dependencies | |
uses: actions/cache@v2 | |
with: | |
path: '**/node_modules' | |
key: node_modules-${{ hashFiles('**/package-lock.json')}} | |
- name: Install dependencies | |
run: | | |
npm ci | |
- name: Build | |
run: npm run build | |
- name: Run unit tests | |
run: npm run test | |
# TODO надо подумать над обходом cloudflare | |
# - name: Run e2e tests | |
# run: npm run test:e2e | |
- name: Run lint | |
run: npm run lint | |
publish: | |
permissions: | |
contents: write | |
needs: | |
- test | |
runs-on: ubuntu-latest | |
if: contains(' | |
refs/heads/dev | |
refs/heads/master | |
', github.ref) || startsWith(github.ref, 'refs/tags') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Use Node.js 18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: cache dependencies | |
uses: actions/cache@v2 | |
with: | |
path: '**/node_modules' | |
key: node_modules-${{ hashFiles('**/package-lock.json')}} | |
- name: Extract branch name | |
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT | |
id: extract_branch | |
- name: Extract tag name | |
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
id: extract_tag | |
- name: Set env | |
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Check env | |
run: | | |
echo $RELEASE_VERSION | |
echo ${{ steps.extract_tag.outputs.tag }} | |
echo ${{ steps.extract_branch.outputs.branch }} | |
# Если мастер - деплоим в корень | |
- name: Set target folder | |
uses: haya14busa/action-cond@v1 | |
id: target_folder | |
if: success() | |
with: | |
cond: ${{ startsWith(github.ref, 'refs/tags') }} | |
if_true: "release" | |
if_false: ${{ steps.extract_branch.outputs.branch }} | |
- name: Install dependencies | |
run: | | |
npm ci | |
- name: Build | |
run: | | |
echo $DOWNLOAD_SUFFIX | |
export DOWNLOAD_SUFFIX=$DOWNLOAD_SUFFIX | |
npm run build | |
env: | |
DOWNLOAD_SUFFIX: '/raw/release/${{ steps.target_folder.outputs.value }}/' | |
- name: Deploy to release branch | |
if: success() | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
# Потом когда сделаю версию на vue то поменяю на apps/web/dist/ | |
folder: apps/web/dist # The folder the action should deploy. | |
clean: true # Automatically remove deleted files from the deploy branch | |
target-folder: ${{ steps.target_folder.outputs.value }} |