-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (45 loc) · 1.83 KB
/
deploy-ec2-prod.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: EC2 Deploy
on:
push:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create necessary directories
run: |
mkdir -p infra/infra-redis/src/main/resources
mkdir -p infra/infra-security/src/main/resources
mkdir -p infra/infra-s3/src/main/resources
mkdir -p data/src/main/resources
- name: Create application-properties.yml
run: |
echo "${{ secrets.APPLICATION_REDIS }}" > infra/infra-redis/src/main/resources/application-redis.yml
echo "${{ secrets.APPLICATION_SECURITY }}" > infra/infra-security/src/main/resources/application-security.yml
echo "${{ secrets.APPLICATION_S3 }}" > infra/infra-s3/src/main/resources/application-s3.yml
echo "${{ secrets.APPLICATION_RDB }}" > data/src/main/resources/application-rdb.yml
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build the Docker image
run: docker build -t ${{ secrets.DOCKERHUB_REPOSITORY }}/kiwing-server:latest .
- name: Docker Push
run: docker push ${{ secrets.DOCKERHUB_REPOSITORY }}/kiwing-server:latest
- name: Trigger Portainer Webhook
run: |
PORTAINER_WEBHOOK_URL=${{ secrets.PORTAINER_WEBHOOK_DNS }}
curl -X POST -d "{}" -H "Content-Type: application/json" --insecure $PORTAINER_WEBHOOK_URL