Skip to content

Commit

Permalink
feat: setting fetch-depth
Browse files Browse the repository at this point in the history
  • Loading branch information
Kang1221 authored Nov 27, 2024
1 parent 3da0f3f commit 279b005
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ jobs:
contents: read

steps:
# Checkout repository
# Checkout repository with fetch-depth: 0
- name: Checkout repository
uses: actions/checkout@v3
with:
token: ${{ secrets.TOKEN }}
submodules: true
fetch-depth: 0 # Fetch the full Git history

# Set up JDK 17
- name: Set up JDK 17
Expand All @@ -37,7 +38,6 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
# Build project with Gradle (excluding tests)
- name: Build with Gradle
run: ./gradlew clean build -x test
Expand All @@ -49,15 +49,18 @@ jobs:
docker build -t ${{ secrets.DOCKERHUB_REPOSITORY }} .
docker tag ${{ secrets.DOCKERHUB_REPOSITORY }} ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPOSITORY }}:${GITHUB_SHA::7}
docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPOSITORY }}:${GITHUB_SHA::7}
# Deploy
deploy:
runs-on: ubuntu-latest
needs: build

steps:
# Checkout repository
# Checkout repository with fetch-depth: 0
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Ensure SHA consistency

# Deploy using SSH
- name: Deploy application
Expand All @@ -72,3 +75,4 @@ jobs:
sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPOSITORY }}:${GITHUB_SHA::7}
sudo docker tag ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPOSITORY }}:${GITHUB_SHA::7} donut
sudo docker-compose up -d --remove-orphans

0 comments on commit 279b005

Please sign in to comment.