Skip to content

Commit

Permalink
[hotfix] #150 - conflict 해결을 위한 gradle.yml 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
khyojun committed Jun 18, 2024
1 parent ee60a83 commit 4cea5ea
Showing 1 changed file with 79 additions and 76 deletions.
155 changes: 79 additions & 76 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,71 +15,74 @@ jobs:
contents: read

steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0

- name: Build with Gradle Wrapper
run: ./gradlew -x test bootJar

- name: Set up Docker Build
uses: docker/setup-buildx-action@v1

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}



- name: Build and push Docker image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/gitbal-be:latest .
docker push ${{ secrets.DOCKER_USERNAME }}/gitbal-be:latest
- name: Create .env file
run: |
echo "${{ secrets.ENV_FILE_CONTENTS }}" > .env
cat .env
- name: Verify docker-compose.yml exists
run: |
ls -la docker-compose.yml

- name: Copy files to EC2
uses: appleboy/scp-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_SSH_KEY }}
source: |
./docker-compose.yml
./.env
target: "/home/${{ secrets.EC2_USER }}/"
debug: true

- name: Deploy to EC2
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_SSH_KEY }}
script: |
echo "${{ secrets.DOCKER_TOKEN }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
cd /home/${{ secrets.EC2_USER }}
sudo bash ./gitbal-deploy.sh
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0

- name: Build with Gradle Wrapper
run: ./gradlew -x test bootJar

- name: Set up Docker Build
uses: docker/setup-buildx-action@v1

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}



- name: Build and push Docker image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/gitbal-be:latest .
docker push ${{ secrets.DOCKER_USERNAME }}/gitbal-be:latest
- name: Create .env file
run: |
echo "${{ secrets.ENV_FILE_CONTENTS }}" > .env
cat .env
- name: Verify docker-compose.yml exists
run: |
ls -la docker-compose.yml
- name: Compress files
run: |
tar -czvf deploy-files.tar.gz docker-compose.yml .env
ls -la deploy-files.tar.gz # Ensure the tar file is created
- name: Copy files to EC2
uses: appleboy/scp-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_SSH_KEY }}
source: deploy-files.tar.gz
target: "/home/${{ secrets.EC2_USER }}/"
debug: true


- name: Deploy to EC2
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USER }}
key: ${{ secrets.EC2_SSH_KEY }}
script: |
echo "${{ secrets.DOCKER_TOKEN }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
cd /home/${{ secrets.EC2_USER }}
sudo bash ./gitbal-deploy.sh
dependency-submission:

Expand All @@ -88,14 +91,14 @@ jobs:
contents: write

steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

# Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies.
# See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

# Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies.
# See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0

0 comments on commit 4cea5ea

Please sign in to comment.