Skip to content

stag-client-api-deploy #2

stag-client-api-deploy

stag-client-api-deploy #2

name: stag-client-api-deploy
on: workflow_dispatch
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'
- name: app clean
run: ./gradlew clean
- name: client api build
run: ./gradlew :likelion-client:build
- name: Docker login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_EMAIL }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: docker image push
run: docker buildx build -f ./likelion-client/Dockerfile --build-arg PROFILE=stag --platform linux/amd64 -t ${{ secrets.DOCKER_CLIENT_API_STAG_IMAGE }} --push .
- name: client-api-deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ubuntu
key: ${{ secrets.KEY }}
script: |
sudo docker rm -f ${{ secrets.DOCKER_CLIENT_API_STAG_CONTAINER }}
sudo docker rmi ${{ secrets.DOCKER_CLIENT_API_STAG_IMAGE }}
docker-compose -f ${{ secrets.DOCKER_COMPOSE_DIRECTORY }} up -d
docker image prune -f