Merge pull request #42 from Coastee/feat/#14-server #20
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: dev server | |
env: | |
JASYPT_KEY: ${{ secrets.JASYPT_KEY }} | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: "corretto" | |
- name: Set up Redis | |
uses: supercharge/[email protected] | |
with: | |
redis-version: 6 | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
shell: bash | |
- name: Build with Gradle | |
run: ./gradlew clean build | |
shell: bash | |
- name: Login to DockerHub | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PWD }} | |
- name: Build and push Docker images | |
uses: docker/[email protected] | |
with: | |
context: . | |
file: Dockerfile | |
push: true | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/coaster | |
build-args: | | |
JASYPT_KEY=${{ secrets.JASYPT_KEY }} | |
- name: Execute remote ssh & Deploy Dev server | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USERNAME }} | |
key: ${{ secrets.SSH_KEY }} | |
port: 22 | |
script: sudo sh deploy.sh |