From 95139e3145bd30accb07ffa72970326505a24263 Mon Sep 17 00:00:00 2001 From: linglong67 <88479739+linglong67@users.noreply.github.com> Date: Sat, 3 Feb 2024 00:55:06 +0900 Subject: [PATCH] Update cicd-dev.yml --- .github/workflows/cicd-dev.yml | 106 ++++++++++++++++----------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/.github/workflows/cicd-dev.yml b/.github/workflows/cicd-dev.yml index 8cab19f0..2797a820 100644 --- a/.github/workflows/cicd-dev.yml +++ b/.github/workflows/cicd-dev.yml @@ -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,16 +58,16 @@ 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 @@ -75,11 +75,11 @@ jobs: 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/ssh-action@v0.1.6 - 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/ssh-action@v0.1.6 + # 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 \ No newline at end of file + # # 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