-
Notifications
You must be signed in to change notification settings - Fork 1
78 lines (70 loc) · 2.18 KB
/
CI_master_push.yaml
File metadata and controls
78 lines (70 loc) · 2.18 KB
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: CI master push
run-name: ${{ github.actor }} pushed to master branch. 🚀 # optional
on:
workflow_dispatch:
inputs:
tag:
description: 'enter version(x.y.z)'
required: true
default: v1.0.0
push:
branches:
- master
env:
TAG: ${{ github.event.inputs.tag }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
jobs:
owner_check:
if: github.repository_owner == 'Atable-Lab'
runs-on: ubuntu-latest
steps:
- run: echo ${{ github.repository_owner }}
build:
if: github.repository_owner == 'Atable-Lab'
runs-on: ubuntu-latest
needs: owner_check
steps:
- uses: actions/checkout@v3
- name: Get service name
run: |
echo "SERVICE=$(echo ${{ github.repository }} | cut -d '/' -f2)" >> $GITHUB_ENV
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Upload Docker Image Latest
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.SERVICE }}:latest
build-args: |
ATABLE_LAB_MONGO_DB_HOST=${{ secrets.ATABLE_LAB_MONGO_DB_HOST }}
ATABLE_LAB_MONGO_DB_ID=${{ secrets.ATABLE_LAB_MONGO_DB_ID }}
ATABLE_LAB_MONGO_DB_PASSWORD=${{ secrets.ATABLE_LAB_MONGO_DB_PASSWORD }}
no-cache: true
- name: Upload Docker Image with Tag
uses: docker/build-push-action@v2
if: ${{ env.VERSION }}
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.SERVICE }}:${{ env.VERSION }}
no-cache: true
- name: Deploy
run: |
echo "Deploy"
notification:
needs: build
runs-on: ubuntu-latest
steps:
- name: Slack
if: always()
uses: 8398a7/action-slack@v3.2.0
with:
status: ${{job.status}}
fields: repo,message,commit,author,action,ref,workflow,job
author_name: Github Action Slack