-
Notifications
You must be signed in to change notification settings - Fork 39
69 lines (67 loc) · 2.26 KB
/
build_publish.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
name: Build and Publish
on:
push:
branches:
- snomed-master
- 'snomed-release-*'
tags:
- 'snomed-[0-9]+.[0-9]+.[0-9]+'
jobs:
build-publish-docker:
name: Build & Publish Docker Image
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.6
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup Java 8
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '8'
- name: Test and Package
run:
./mvnw -T 4 --no-transfer-progress -DskipTests clean package -U
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Docker Build and push
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
file: package/docker/bahmni-reports/Dockerfile
push: true
tags: bahmni/reports:snomed-${{ github.run_number }},bahmni/reports:snomed-latest
trigger:
name: Trigger Deployment Workflow to SNOMED Environment
needs:
- build-publish-docker
runs-on: ubuntu-latest
env:
ORG_NAME: Bahmni
REPOSITORY_NAME: snomed-bahmni-docker
ENVIRONMENT: dev
steps:
- name: Create workflow_dispatch
run: |
trigger_result=$(curl -s -o trigger_response.txt -w "%{http_code}" -X POST -H "Accept: application/vnd.github.v3+json" -H 'authorization: Bearer ${{ secrets.BAHMNI_PAT }}' https://api.github.com/repos/${ORG_NAME}/${REPOSITORY_NAME}/actions/workflows/snomed-deploy.yml/dispatches -d '{"ref":"snomed-master","inputs":{"environment":"'"${ENVIRONMENT}"'"}}')
if [ $trigger_result == 204 ];then
echo "Trigger to $ORG_NAME/$REPOSITORY_NAME Success"
else
echo "Trigger to $ORG_NAME/$REPOSITORY_NAME Failed"
cat trigger_response.txt
exit 1
fi