-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (78 loc) · 3.24 KB
/
ci-cd.yaml
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
name: CI/CD Workflow
on:
push:
pull_request:
branches:
- master
env:
PLATFORMS: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
jobs:
build-project:
runs-on: ubuntu-latest
steps:
# Open-Source Machine emulator that allows you to emulate multiple CPU architectures on your machine
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Inspect builder
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
echo "Status: ${{ steps.buildx.outputs.status }}"
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
- name: Checkout Code
uses: actions/checkout@v2
- name: List Files
run: ls -alrt
- name: Build Project
run: ./mvnw package
- name: print Context info
run: |
echo ${{github.event_name}}
echo ${{github.ref}}
- name: Login in quay.io
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: docker login -u "${{secrets.QUAY_USERNAME}}" -p "${{secrets.QUAY_PASSWORD}}" quay.io
- name: Build and Puh image to quay.io
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: docker buildx build --push -f src/main/docker/Dockerfile.jvm -t quay.io/rishabprasad005/my-project:multi-arch --platform ${{env.PLATFORMS}} .
- name: Login in dockerhub
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: docker login -u "${{secrets.DOCKERHUB_USERNAME}}" -p "${{secrets.DOCKERHUB_PASSWORD}}" docker.io
- name: Build and Puh image to docker.io
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: docker buildx build --push -f src/main/docker/Dockerfile.jvm -t rishabprasad005/my-project:multi-arch --platform ${{env.PLATFORMS}} .
- name: List images
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: docker images
- name: Google Chat Notification
uses: Co-qn/google-chat-notification@releases/v1
if: always()
with:
name: ${{github.workflow}}
url: ${{ secrets.GCHAT_WEBHOOK }}
status: ${{ job.status }}
trigger-mt-ui-build:
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && !contains(github.event.*.labels.*.name, 'DO NOT MERGE')
runs-on: ubuntu-latest
needs: [build-project]
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: changes
with:
base: master
list-files: 'csv'
filters: |
src:
- 'src/**'
- name: Repository Dispatch
if: steps.changes.outputs.src == 'true'
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.ACCESS_TOKEN }}
repository: rishab-prasad/practice-github-actions
event-type: on-src-updated