-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (72 loc) · 2.55 KB
/
ci.yml
File metadata and controls
74 lines (72 loc) · 2.55 KB
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
name: CI
on:
pull_request:
branches: [develop, master22]
push:
branches: [develop, master22]
jobs:
build:
runs-on: ubuntu-latest
env:
SURGE_LOGIN: ${{ secrets.SURGE_LOGIN}}
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN}}
steps:
- uses: actions/checkout@v2
- name: Cache node_modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Use NodeJS
uses: actions/setup-node@v1
with:
node-version: "16.x"
- run: npm ci
- run: npm run format:check
- run: npm test -- --coverage
env:
CI: true
- name: Upload test coverage
uses: actions/upload-artifact@v1
with:
name: code-coverage
path: coverage
- name: Build Project
if: github.event_name == 'push'
run: npm run build
- name: Upload build folder
if: github.event_name == 'push'
uses: actions/upload-artifact@v1
with:
name: build
path: build
- name: ZIP assets
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
zip -r build.zip ./build
zip -r coverage.zip ./coverage
- name: Create a release
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy to Staging
if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
run: npx surge --project ./build --domain br648.surge.sh
- name: Deploy to Prod
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: npx surge --project ./build --domain whispering-fact.surge.sh
- name: Open issue
if: failure() && github.event_name == 'pull_request'
run: |
curl --request POST \
--url https://api.github.com/repos/${{ github.repository }}/issues \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
--data '{
"title": "Automated issue for commit: ${{ github.sha }}",
"body": "This issue was automatically created by the GitHub Action workflow **${{ github.workflow }}**. \n\n The commit hash was: _${{ github.sha }}_.",
"assignees": ["${{ gihub.event.pull_request.user.login }}"]
}'