-
Notifications
You must be signed in to change notification settings - Fork 34
59 lines (55 loc) · 2.53 KB
/
ci-build-image.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
name: CI Build / Push Image
on:
repository_dispatch:
types: [build-image-command]
env:
REGISTRY: ghcr.io
REPOSITORY: ${{ github.event.client_payload.github.payload.repository.full_name }}
DEFAULT_TAG: SNAPSHOT-PR-${{ github.event.client_payload.github.payload.issue.number }}
FULL_NAME: bayesian-data-model-importer
jobs:
Build-push-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
git fetch origin +refs/pull/${{ github.event.client_payload.github.payload.issue.number }}/merge
git checkout FETCH_HEAD
- name: Create comment
uses: peter-evans/create-or-update-comment@v1
with:
edit-mode: replace
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
body: |
**Edit:** :test_tube: [CI has Started Image Build]( https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})
reactions: eyes
- name: Login to Github Container Registry
uses: docker/login-action@v1
with:
registry: ${{ env. REGISTRY }}
username: ${{ github.event.client_payload.github.actor }}
password: ${{ secrets.CR_PAT }}
- name: Build Image
run: docker build --no-cache -t ${{env.REGISTRY}}/${{env.REPOSITORY}}/${{env.FULL_NAME}}:${{env.DEFAULT_TAG}} -f Dockerfile.data-model .
- name: Push Image
run: docker push ${{env.REGISTRY}}/${{env.REPOSITORY}}/${{env.FULL_NAME}}:${{env.DEFAULT_TAG}}
- name: Create success comment
if: success()
uses: peter-evans/create-or-update-comment@v1
env:
IMAGE_URL: ${{env.REGISTRY}}/${{env.REPOSITORY}}/${{env.FULL_NAME}}:${{env.DEFAULT_TAG}}
with:
edit-mode: replace
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
body: |
**Edit:** :v: [Image Build Successfull]( https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}) @${{github.event.client_payload.github.actor}}, Avaliable at: ```${{ env.IMAGE_URL }}```
reactions: hooray, heart
- name: Create fail comment
if: failure()
uses: peter-evans/create-or-update-comment@v1
with:
edit-mode: replace
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
body: |
**Edit:** :facepalm: [Build and Push Image Failed]( https://github.com/${{github.repository}}/actions/runs/${{github.run_id}})
reactions: confused