-
Notifications
You must be signed in to change notification settings - Fork 15
43 lines (36 loc) · 985 Bytes
/
Copy pathmain.yml
File metadata and controls
43 lines (36 loc) · 985 Bytes
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
name: CI
on:
push:
branches:
- main
- develop
pull_request:
branches: [develop]
env:
GET_REPO: export REPO=${GITHUB_REPOSITORY#*/}
GET_HASH: export HASH=${GITHUB_SHA}
jobs:
CI:
name: CI
runs-on: self-hosted
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Build Docker image
run: |
eval $GET_REPO
eval $GET_HASH
echo "=== Build start==="
echo ${HASH}
echo ${REPO}
echo ${{ github.head_ref }}
cd docker
docker build --force-rm --no-cache --tag "ccpt:${HASH}" --build-arg BRANCH=${{ github.head_ref }} .
echo "=== Build finished==="
- name: Clean up Docker image if build fails
if: failure()
run: |
echo "=== Remove failed image start==="
docker rmi -f $(docker images -f "dangling=true" -q)
docker images
echo "=== Removal finished==="