-
Notifications
You must be signed in to change notification settings - Fork 8
71 lines (63 loc) · 2.13 KB
/
prod.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
name: Build and Deploy (production)
on:
release:
types: [published]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '10.x'
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci
- name: lint
run: npm run lint
- name: Build
env:
APP_URL: https://itgm.aidbox.io
APP_CLIENT_ID: app-client
APP_INIT_CLIENT_ID: ${{ secrets.app_client }}
APP_INIT_CLIENT_SECRET: ${{ secrets.app_secret }}
YANDEX_MAP_API_KEY: ${{ secrets.YANDEX_MAP_API_KEY }}
run: |
npm run build
npm run configure
- name: Docker
env:
APP_IMAGE: docker.pkg.github.com/piter-united/itgm/spa
APP_VERSION: ${{ github.ref }}
DOCKER_USERNAME: ${{ secrets.docker_user }}
DOCKER_PASSWORD: ${{ secrets.docker_password }}
run: |
export APP_VERSION=$(sed 's/refs\/tags\///g' <<< $APP_VERSION)
docker login docker.pkg.github.com -u ${DOCKER_USERNAME} -p "${DOCKER_PASSWORD}"
docker build . --file Dockerfile --tag $APP_IMAGE:$APP_VERSION
docker push $APP_IMAGE:$APP_VERSION
- name: Deploy
env:
APP_ENV: ui
APP_IMAGE: docker.pkg.github.com/piter-united/itgm/spa
APP_VERSION: ${{ github.ref }}
KUBECONFIG: ${{ secrets.kubeconfig }}
run: |
export APP_VERSION=$(sed 's/refs\/tags\///g' <<< $APP_VERSION)
echo $KUBECONFIG | base64 -d > ./kubeconfig.yml
curl -L https://github.com/niquola/envtpl/releases/download/0.0.3/envtpl.linux > envtpl
chmod +x envtpl
cat ./.github/deployment.yml | ./envtpl > deploy.yml
kubectl apply --kubeconfig ./kubeconfig.yml -f ./deploy.yml
- uses: appleboy/telegram-action@master
if: always()
with:
to: ${{ secrets.chat }}
token: ${{ secrets.token }}