Skip to content

πŸš‘οΈ Rollback scheduled time #131

πŸš‘οΈ Rollback scheduled time

πŸš‘οΈ Rollback scheduled time #131

Workflow file for this run

name: CD
on:
push:
branches: [ develop ]
env:
DOCKER_IMAGE: bae4614/aloc-spring
VERSION: latest
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Make gradlew executable
run: chmod +x gradlew
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper/dists
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
gradle-${{ runner.os }}-
- name: Create application.yml
run: |
mkdir -p ./src/main/resources
cd ./src/main/resources
echo "${{ secrets.APPLICATION }}" base64 -d > application.yml
echo "${{ secrets.JWT_APPLICATION }}" base64 -d > application-jwt.yml
echo "${{ secrets.TEST_APPLICATION }}" base64 -d > application-test.yml
- name: Build with Gradle
run: ./gradlew build --parallel --daemon
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/aloc-spring:latest
- name: Deploy to Amazon Lightsail
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.LIGHTSAIL_HOST }}
username: ${{ secrets.LIGHTSAIL_USER }}
key: ${{ secrets.LIGHTSAIL_SSH_KEY }}
script: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker pull ${{ secrets.DOCKER_USERNAME }}/aloc-spring:latest
docker stop aloc-spring || true
docker rm aloc-spring || true
docker run -d --name aloc-spring \
-e TZ=Asia/Seoul \
--network my_network \
--ip 172.18.0.2 \
-p 8080:8080 \
-v /home/ubuntu/upload/user:/app/upload \
${{ secrets.DOCKER_USERNAME }}/aloc-spring:latest
- name: Send deployment status to Discord
if: success()
uses: tsickert/[email protected]
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
content: |
[aloc-spring]
배포가 μ„±κ³΅μ μœΌλ‘œ μ™„λ£Œλ˜μ—ˆμ–΄μš” πŸš€
μ»€λ°‹ν•œ μ‚¬λžŒ πŸ™‹πŸ»${{ github.actor }}
${{ github.event.head_commit.message }}
- name: Send deployment failure to Discord
if: failure()
uses: tsickert/[email protected]
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
content: |
[aloc-spring]
배포 쀑 λ¬Έμ œκ°€ λ°œμƒν–ˆμ–΄μš” ❌
잘λͺ»ν•œ μ‚¬λžŒ πŸ™‹πŸ»${{ github.actor }}
url: https://github.com/ALOC-UOS/aloc-backend/actions/runs/${{ github.run_id }}
${{ github.event.head_commit.message }}