Skip to content

Merge pull request #221 from Team-Hankki/develop #7

Merge pull request #221 from Team-Hankki/develop

Merge pull request #221 from Team-Hankki/develop #7

Workflow file for this run

name: CD
on:
push:
branches: [ "main" ]
jobs:
CI:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GIT_SECRET }}
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'corretto'
- name: Copy yml files
run: ./gradlew copyYml
shell: bash
- name: build with gradle
run: |
chmod +x gradlew
./gradlew clean build -x test
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Login to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile-prod
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.PROD_REPO_NAME }}
CD:
needs: CI
runs-on: ubuntu-22.04
steps:
- name: Docker Image Pull and Container Run
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.PROD_SERVER_HOST }}
username: ${{ secrets.PROD_USERNAME }}
key: ${{ secrets.PROD_SERVER_KEY }}
script: |
cd ~
./deploy.sh