Merge pull request #449 from Team-Ampersand/448-dotori-thanks-for-con… #115
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Java CICD with Gradle | |
on: | |
push: | |
branches: | |
- 'develop' | |
jobs: | |
build: | |
runs-on: self-hosted | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{secrets.DOCKERHUB_USERNAME}} | |
password: ${{secrets.DOCKERHUB_TOKEN}} | |
- name: Deploy to dev | |
uses: appleboy/ssh-action@master | |
id: dotori-dev | |
with: | |
host: ${{ secrets.HOST_DEV }} | |
username: ubuntu | |
password: ${{ secrets.PASSWORD }} | |
port: 22 | |
key: ${{ secrets.KEYPAIR }} | |
script: | | |
sudo docker ps | |
sudo docker rm -f dotori-dev 2>/dev/null || true | |
sudo docker pull ${{secrets.DOCKERHUB_USERNAME}}/dotori-dev | |
sudo docker run --net="host" --name dotori-dev --rm -d -p 8080:8080 ${{secrets.DOCKERHUB_USERNAME}}/dotori-dev | |
sudo docker image prune -f |