Skip to content

Test actions commit

Test actions commit #9

Workflow file for this run

name: CD Pipeline
on:
push:
branches:
- action
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- run: echo "${{ secrets.APPLICATION }}" > ./src/main/resources/application.yml
- name: Gradle Caching
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker image build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/backend:latest
- name: Deploy Application
uses: appleboy/[email protected]
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USERNAME }}
key: ${{ secrets.REMOTE_KEY }}
script: |
echo "### Change directory to Backend ###"
cd /home/***/Backend
echo "### Pull origin main from github ###"
git pull origin actions
echo "### Shutdown existing container ###"
sudo docker compose down
echo "### Turn on new container ###"
sudo docker compose up -d