-
Notifications
You must be signed in to change notification settings - Fork 1
78 lines (63 loc) · 1.87 KB
/
main.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
name: KBOT-CICD
on:
push:
paths:
- 'src/**'
jobs:
ci:
name: CI
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: "1"
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run linter
run: make lint
- name: Run unit tests
run: make unit-test
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Declare SHA vars to use on other actions
id: vars
shell: bash
run: |
echo "GITHUB_SHA: ${GITHUB_SHA}"
echo "::set-output name=sha_short::${GITHUB_SHA::7}"
- name: Build and Push
uses: docker/build-push-action@v2
with:
push: true
build-args: APP_BUILD_INFO=${{ steps.vars.outputs.sha_short }}
tags: denvasyliev/kbot:build-${{ steps.vars.outputs.sha_short }}
cd:
name: CD
needs: ci
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Declare SHA vars to use on other actions
id: vars
shell: bash
run: |
echo "GITHUB_SHA: ${GITHUB_SHA}"
echo "::set-output name=sha_short::${GITHUB_SHA::7}"
- name: update current version
uses: mikefarah/[email protected]
with:
cmd: yq w -i helm/values.yaml image.tag build-${{ steps.vars.outputs.sha_short }}
- name: setup git config
run: |
git config user.name "GitHub Actions"
git config user.email "<>"
git add helm/values.yaml
git commit -m "update code version to ${{ steps.vars.outputs.sha_short }}"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.ACTIONS_TOKEN }}
branch: develop