Skip to content

Deploy and Start services by caniro #30

Deploy and Start services by caniro

Deploy and Start services by caniro #30

Workflow file for this run

name: CI/CD Deploy and Start services
run-name: Deploy and Start services by ${{github.actor}}
on:
push:
branches:
- main
paths:
- 'src/**'
jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build with Gradle Wrapper
run: ./gradlew build -x test
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKER_USERNAME}}
password: ${{secrets.DOCKER_TOKEN}}
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{secrets.DOCKER_USERNAME}}/if-be:latest
start-services:
needs: build
runs-on: ubuntu-latest
steps:
- name: Connect to cloud server and run Docker commands
uses: appleboy/[email protected]
with:
host: ${{secrets.BACKEND_HOST}}
username: ${{secrets.CLOUD_USERNAME}}
key: ${{secrets.CLOUD_SECRET_KEY}}
port: ${{secrets.CLOUD_PORT}}
script: |
cd ~
/bin/bash run_springboot.sh