Skip to content

Commit

Permalink
chore: cicd 개편
Browse files Browse the repository at this point in the history
  • Loading branch information
KarmaPol committed Jul 5, 2024
1 parent 370e5f5 commit c13486d
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/deploy-prod-new.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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

0 comments on commit c13486d

Please sign in to comment.