Skip to content

πŸš€ Merge pull request #38 from local-mood/fix/31-redis-info #17

πŸš€ Merge pull request #38 from local-mood/fix/31-redis-info

πŸš€ Merge pull request #38 from local-mood/fix/31-redis-info #17

Workflow file for this run

name: Java CI with Gradle
on:
push:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
- name: Make application-secret.yaml
run: |
cd ./src/main/resources
touch ./application-secret.yml
echo "${{ secrets.APPLICATION_SECRET }}" > ./application-secret.yml
shell: bash
- name: Build with Gradle
run: |
chmod +x ./gradlew
./gradlew clean build -x test
- name: Docker build & push to docker repo
run: |
docker login -u ${{ secrets.DOCKER_NAME }} -p ${{ secrets.DOCKER_PW }}
docker build -f Dockerfile -t ${{ secrets.DOCKER_NAME }}/${{ secrets.DOCKER_REPO }} .
docker push ${{ secrets.DOCKER_NAME }}/${{ secrets.DOCKER_REPO }}
- name: Deploy to server
uses: appleboy/ssh-action@master
id: deploy
with:
host: ${{ secrets.HOST }}
username: ubuntu
key: ${{ secrets.KEY }}
envs: GITHUB_SHA
script: |
sudo docker rm -f $(docker ps -qa)
sudo docker pull ${{ secrets.DOCKER_NAME }}/${{ secrets.DOCKER_REPO }}
docker-compose up -d
docker image prune -f