forked from digitomize/digitomize
-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (46 loc) · 1.84 KB
/
deploy.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
name: Build and Deploy
on:
push:
branches:
- "main"
paths:
- backend
jobs:
build:
name: "building docker image"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set outputs
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Check outputs
run: echo ${{ steps.vars.outputs.sha_short }}
- name: find and replace docker image version
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "latest"
replace: "${{ steps.vars.outputs.sha_short }}"
include: "service.yml"
regex: true
- name: "build image"
run: |
docker build -t pranshugupta54/backend:${{ steps.vars.outputs.sha_short }} -f backend.Dockerfile .
- name: push
if: github.ref == 'refs/heads/main'
run: |
echo "${{ secrets.DOCKER_HUB_PASS }}" | docker login -u "pranshugupta54" --password-stdin
docker push pranshugupta54/backend:${{ steps.vars.outputs.sha_short }}
- name: replace service file for meltcd
if: github.ref == 'refs/heads/main'
uses: dmnemec/copy_file_to_another_repo_action@main
env:
API_TOKEN_GITHUB: ${{ secrets.GH_PERM }}
BUILD_VERSION: ${{ steps.vars.outputs.sha_short }}
with:
source_file: 'service.yml'
destination_repo: 'digitomize/infra'
destination_branch: 'main'
user_email: '[email protected]'
user_name: 'pranshugupta54'
commit_message: 'Update docker image version for MeltCD'