forked from Kernel360/F1-WashFit-BE
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dde2526
commit 95139e3
Showing
1 changed file
with
53 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ name: CI and CD in WashPedia Project | |
|
||
on: | ||
push: | ||
branches: [ "develop" ] | ||
branches: [ "feature/develop-deploy-in-vultr" ] | ||
|
||
permissions: | ||
contents: read | ||
|
@@ -42,12 +42,12 @@ jobs: | |
env: | ||
spring.profiles.active: "dev" | ||
|
||
- name: Set application yml file (batch) | ||
uses: microsoft/variable-substitution@v1 | ||
with: | ||
files: ./module-batch/src/main/resources/application.yml | ||
env: | ||
spring.profiles.active: "dev" | ||
# - name: Set application yml file (batch) | ||
# uses: microsoft/variable-substitution@v1 | ||
# with: | ||
# files: ./module-batch/src/main/resources/application.yml | ||
# env: | ||
# spring.profiles.active: "dev" | ||
|
||
- name: Set application-dev yml file (api) | ||
uses: microsoft/variable-substitution@v1 | ||
|
@@ -58,28 +58,28 @@ jobs: | |
spring.datasource.username: ${{ secrets.DB_USER }} | ||
spring.datasource.password: ${{ secrets.DB_PW }} | ||
|
||
- name: Set application-dev yml file (batch) | ||
uses: microsoft/variable-substitution@v1 | ||
with: | ||
files: ./module-batch/src/main/resources/application-dev.yml | ||
env: | ||
spring.datasource.url: ${{ secrets.DB_URL }} | ||
spring.datasource.username: ${{ secrets.DB_USER }} | ||
spring.datasource.password: ${{ secrets.DB_PW }} | ||
external.ecolife-api.path: ${{ secrets.ECOLIFE_PATH }} | ||
external.ecolife-api.service-key: ${{ secrets.ECOLIFE_KEY }} | ||
# - name: Set application-dev yml file (batch) | ||
# uses: microsoft/variable-substitution@v1 | ||
# with: | ||
# files: ./module-batch/src/main/resources/application-dev.yml | ||
# env: | ||
# spring.datasource.url: ${{ secrets.DB_URL }} | ||
# spring.datasource.username: ${{ secrets.DB_USER }} | ||
# spring.datasource.password: ${{ secrets.DB_PW }} | ||
# external.ecolife-api.path: ${{ secrets.ECOLIFE_PATH }} | ||
# external.ecolife-api.service-key: ${{ secrets.ECOLIFE_KEY }} | ||
|
||
- name: Grant execute permission And Build with Gradle (api) | ||
working-directory: ./module-api | ||
run: | | ||
chmod +x ./gradlew | ||
./gradlew clean build | ||
- name: Grant execute permission And Build with Gradle (batch) | ||
working-directory: ./module-batch | ||
run: | | ||
chmod +x ./gradlew | ||
./gradlew clean build | ||
# - name: Grant execute permission And Build with Gradle (batch) | ||
# working-directory: ./module-batch | ||
# run: | | ||
# chmod +x ./gradlew | ||
# ./gradlew clean build | ||
|
||
- name: DockerHub Login | ||
uses: docker/login-action@v2 | ||
|
@@ -90,35 +90,35 @@ jobs: | |
- name: Docker Image Build And Push (api) | ||
working-directory: ./module-api | ||
run: | | ||
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.MODULE_API_NAME }} . --platform=linux/amd64 | ||
docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.MODULE_API_NAME }} | ||
- name: Docker Image Build And Push (batch) | ||
working-directory: ./module-batch | ||
run: | | ||
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.MODULE_BATCH_NAME }} . --platform=linux/amd64 | ||
docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.MODULE_BATCH_NAME }} | ||
- name: Application Run | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.VULTR_IP }} | ||
username: ${{ secrets.VULTR_USERNAME }} | ||
password: ${{ secrets.VULTR_PW }} | ||
script: | | ||
# Install Docker and Docker Compose | ||
dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo | ||
dnf install -y docker-ce docker-ce-cli containerd.io | ||
systemctl start docker | ||
systemctl enable docker | ||
curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | ||
chmod +x /usr/local/bin/docker-compose | ||
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.MODULE_API_NAME }}2 . --platform=linux/amd64 | ||
docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.MODULE_API_NAME }}2 | ||
# - name: Docker Image Build And Push (batch) | ||
# working-directory: ./module-batch | ||
# run: | | ||
# docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.MODULE_BATCH_NAME }} . --platform=linux/amd64 | ||
# docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.MODULE_BATCH_NAME }} | ||
|
||
# - name: Application Run | ||
# uses: appleboy/[email protected] | ||
# with: | ||
# host: ${{ secrets.VULTR_IP }} | ||
# username: ${{ secrets.VULTR_USERNAME }} | ||
# password: ${{ secrets.VULTR_PW }} | ||
# script: | | ||
# # Install Docker and Docker Compose | ||
# dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo | ||
# dnf install -y docker-ce docker-ce-cli containerd.io | ||
# systemctl start docker | ||
# systemctl enable docker | ||
# curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | ||
# chmod +x /usr/local/bin/docker-compose | ||
|
||
# Docker Compose | ||
mkdir -p deploy | ||
cd deploy | ||
echo "${{ secrets.DB_INIT_SQL }}" > init.sql | ||
echo "${{ secrets.DOCKER_COMPOSE }}" > docker-compose.yml | ||
docker-compose pull | ||
docker-compose down | ||
docker-compose up -d | ||
# # Docker Compose | ||
# mkdir -p deploy | ||
# cd deploy | ||
# echo "${{ secrets.DB_INIT_SQL }}" > init.sql | ||
# echo "${{ secrets.DOCKER_COMPOSE }}" > docker-compose.yml | ||
# docker-compose pull | ||
# docker-compose down | ||
# docker-compose up -d |