-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (65 loc) · 2.38 KB
/
build.yaml
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
name: deploy
on:
pull_request:
branches: [ main, dev ]
jobs:
build-and-push:
name: Deploy images on the destination server
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'}}
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
registry: registry.andyi95.com
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Set APP_VERSION
run: echo "APP_VERSION=$(echo ${GITHUB_SHA::8})" >> $GITHUB_ENV
- name: Build and push frontend
uses: docker/build-push-action@v2
with:
context: frontend
file: frontend/stage.Dockerfile
push: true
tags: registry.andyi95.com/text-tools/reading-frontend:${{ env.APP_VERSION }}
- name: Build and push backend
uses: docker/build-push-action@v2
with:
context: backend
file: backend/Dockerfile
push: true
tags: registry.andyi95.com/text-tools/reading-backend:${{ env.APP_VERSION }}
- name: Test start configuration
env:
COMPOSE_FILE: docker-compose.yaml:docker-compose.override.yaml:docker-compose.stage.yaml
run: |
docker-compose up -d
docker-compose ps
sleep 10
if [ $(docker-compose ps -q | wc -l) -ne $(docker-compose config --services | wc -l) ]; then
echo "Not all containers are running."
docker-compose ps
exit 1
fi
docker-compose down
send-telegram-message:
name: send-telegram-message
runs-on: ubuntu-latest
steps:
- name: send telegram message
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
Report on the last run of ${{ github.workflow }}.
${{ github.job }} in workflow ${{ github.action }} from repo ${{ github.repository }} has finished with status ${{ job.status }}.