-
Notifications
You must be signed in to change notification settings - Fork 323
151 lines (143 loc) · 5.06 KB
/
build.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Build Docker Image
on:
push:
branches: [ main ]
tags:
- "v*.*.*"
paths-ignore:
- '.github/**'
- 'docs/**'
- '*.md'
pull_request_review:
types: [submitted]
jobs:
docker:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Build Start
id: ci_start
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
channel: 'C0786MHAL8J'
text: "Build started 👀"
attachments:
- color: "dbab09"
fields:
- title: "Repository"
short: true
value: ${{ github.repository }}
- title: "Status"
short: true
value: "In Progress"
- title: "Branch"
short: true
value: ${{ github.ref }}
- title: "Author"
short: true
value: ${{ github.actor }}
- title: "Action"
value: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- title: "Diff"
value: ${{ github.event.pull_request.html_url || github.event.head_commit.url }}
- title: "Changes"
value: |
${{github.event.head_commit.message}}
- name: Docker meta
id: meta
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96
with:
# list of Docker images to use as base name for tags
images: |
crestal/intentkit
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5
- name: Login to Docker Hub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
username: crestal
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355
with:
build-args: |
RELEASE=${{ github.sha }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build Success
if: ${{ success() }}
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d
with:
method: chat.update
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
channel: 'C0786MHAL8J'
ts: "${{ steps.ci_start.outputs.ts }}"
text: "Build Succeeded ✅"
attachments:
- color: "28a745"
fields:
- title: "Repository"
short: true
value: ${{ github.repository }}
- title: "Status"
short: true
value: "Completed"
- title: "Branch"
short: true
value: ${{ github.ref }}
- title: "Author"
short: true
value: ${{ github.actor }}
- title: "Image"
value: https://hub.docker.com/r/crestal/intentkit/tags
- title: "Diff"
value: ${{ github.event.pull_request.html_url || github.event.head_commit.url }}
- title: "Changes"
value: |
${{github.event.head_commit.message}}
- name: Build Failure
if: ${{ failure() }}
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d
with:
method: chat.update
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
channel: 'C0786MHAL8J'
ts: "${{ steps.ci_start.outputs.ts }}"
text: "Build Failed ❌"
attachments:
- color: "dc3545"
fields:
- title: "Repository"
short: true
value: ${{ github.repository }}
- title: "Status"
short: true
value: "Failed"
- title: "Branch"
short: true
value: ${{ github.ref }}
- title: "Author"
short: true
value: ${{ github.actor }}
- title: "Action"
value: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- title: "Diff"
value: ${{ github.event.pull_request.html_url || github.event.head_commit.url }}
- title: "Changes"
value: |
${{github.event.head_commit.message}}