Skip to content

Commit

Permalink
Merge pull request #43 from H-Hive/EUNCHAEv1006-patch-1
Browse files Browse the repository at this point in the history
Create gradle.yml
  • Loading branch information
EUNCHAEv1006 authored Jan 12, 2024
2 parents 430b3ab + 0cf11dd commit f348252
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: hhive

on:
pull_request:
branches: [ dev ]
types: [closed]

jobs:
build-docker-image:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build with Gradle
run: ./gradlew build

- name: web docker build and push
run: |
sudo docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}
sudo docker build -f Dockerfile -t ${{ secrets.DOCKERHUB_USERNAME }}/hhive .
sudo docker push ${{ secrets.DOCKERHUB_USERNAME }}/hhive
- name: Deploy Front to prod
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.AWS_HOST }}
username: ubuntu
key: ${{ secrets.AWS_SSH_KEY }}
port: 22
script: |
if docker ps -a --format ‘{{.ID}}’ | grep -q .; then
sudo docker rm -f $(docker ps -qa)
else
echo “No Docker containers to remove.”
fi
sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/hhive
sudo docker run --name hhive -d ${{ secrets.DOCKERHUB_USERNAME }}/hhive
sudo docker run --name redis-server -d -p 6379:6379 redis
docker image prune -f

0 comments on commit f348252

Please sign in to comment.