-
Notifications
You must be signed in to change notification settings - Fork 13
80 lines (78 loc) · 2.73 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: FE build action
on:
pull_request:
branches:
- 'develop'
push:
branches:
- '**'
tags-ignore:
- 'dockerImage.v.*'
jobs:
build:
name: Build & Release
if: "!contains(github.event.head_commit.author, '[email protected]')"
permissions:
checks: write
runs-on: ubuntu-latest
steps:
- name: set env
run: |
echo BRANCH=$(echo -n "${GITHUB_REF#refs/heads/}") >> $GITHUB_ENV
if [ "${{ github.ref }}" = "refs/heads/staging" ]; then
echo ENV_NAME="staging" >> $GITHUB_ENV
else
echo ENV_NAME="prod" >> $GITHUB_ENV
fi
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://npm.pkg.github.com'
cache: 'npm'
- name: Load .env file
uses: xom9ikk/dotenv@v2
with:
mode: ${{ env.ENV_NAME }}
- run: npm ci
- name: Run linters
uses: wearerequired/lint-action@v2
with:
github_token: ${{ secrets.github_token }}
eslint: true
eslint_dir: ./src
eslint_extensions: js,ts,tsx
stylelint: true
stylelint_dir: ./src
stylelint_extensions: scss
prettier: true
- name: Run build
run: |
npm run build
- name: Run tests
run: |
echo "127.0.0.1 localhost" | sudo tee -a /etc/hosts
echo "fs.inotify.max_user_watches=524288" | sudo tee -a /etc/sysctl.conf
npm run test:build
- name: Run component tests
run: |
npm run test:components
- name: Bump version
if: startsWith(env.BRANCH,'release') == true
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
npm run release
- name: Push changes
if: startsWith(env.BRANCH,'release') == true
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{env.BRANCH}}
force: true
tags: true
- uses: actions/upload-artifact@v2
if: failure()
with:
name: cypress-videos
path: cypress/videos/