-
Notifications
You must be signed in to change notification settings - Fork 80
61 lines (51 loc) · 1.77 KB
/
docker_Push.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
name: CD-Build
on:
push:
branches:
- master
paths:
- "website/**"
jobs:
build-and-push:
runs-on: ubuntu-latest
outputs:
TAG: ${{ steps.vars.outputs.branch }}-${{ steps.vars.outputs.sha_short }}
steps:
- uses: actions/checkout@v2
- name: Declare some variables
id: vars
shell: bash
run: |
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Docker login
run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USER }} --password-stdin
- name: Build and Push the Docker Image
run: |
docker build -t ${GITHUB_REPOSITORY}:${{ steps.vars.outputs.branch }}-${{ steps.vars.outputs.sha_short }} .
docker push ${GITHUB_REPOSITORY}:${{ steps.vars.outputs.branch }}-${{ steps.vars.outputs.sha_short }}
deploy:
runs-on: ubuntu-latest
needs:
- build-and-push
defaults:
run:
shell: bash
working-directory: k8s-infra/litmus-docs/base
steps:
- name: Checking out CD repository
uses: actions/checkout@v2
with:
ref: "master"
repository: litmuschaos/litmus-cd
token: ${{ secrets.CD_PUSH_TOKEN }}
- name: Updating the manifests and pushing
run: |
tag=${{ needs.build-and-push.outputs.TAG }}
# Deployment Images Update
sed -i -e "s|litmuschaos/litmus-docs:.*|litmuschaos/litmus-docs:$tag|g" litmusdocs-deploy.yaml
git config user.name litmuschaos-bot
git config user.email [email protected]
git add .
git commit -m "Manifest updated for litmus-docs"
git push origin master