-
Notifications
You must be signed in to change notification settings - Fork 33
83 lines (63 loc) · 1.94 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
81
82
83
name: build
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name:
uses: actions/setup-node@v1
- run: npm ci
- run: npm run prettier:check
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: docker build -t local/carbonara .
- run: docker run -v $(pwd)/test/images:/home/pptruser/app/test/images --rm local/carbonara npm test
- uses: actions/upload-artifact@v2
if: failure()
with:
name: screenshots
path: test/images/
push:
needs: [lint, test]
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v2
- name: Log into dockerhub registry
run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u petersolopov --password-stdin
- name: Push images
run: |
docker build --file Dockerfile --build-arg npm-ci-params="--only=production" -t petersolopov/carbonara .
docker push petersolopov/carbonara:latest
deploy:
needs: [lint, test]
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- name: deploy
run: |
curl -s ${{ secrets.DEPLOY_HOOK }} \
> /dev/null
notify:
needs: [lint, test, push, deploy]
runs-on: ubuntu-latest
if: github.event_name == 'push' && failure()
steps:
- name: notify
run: |
curl -s https://api.telegram.org/bot$TELEGRAM_TOKEN/sendMessage \
-d parse_mode=markdown \
-d chat_id=$CHAT_ID \
-d text="🚫 [$GITHUB_REPOSITORY](https://github.com/$GITHUB_REPOSITORY/actions/runs/$RUN_ID) build action was failed" \
> /dev/null
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
CHAT_ID: ${{ secrets.CHAT_ID}}
RUN_ID: ${{ github.run_id }}