Merge pull request #345 from IceButler/refactor/#330-food-searchByBar… #15
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: deploy | |
on: | |
push: | |
branches: [ "develop" ] | |
jobs: | |
deploy: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Gradle Caching | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- run: touch ./src/main/resources/application.yml | |
- run: echo "${{ secrets.APPLICATION_SECRET }}" > ./src/main/resources/application.yml | |
- run: cat ./src/main/resources/application.yml | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
shell: bash | |
- name: Build and no Test | |
run: ./gradlew build -x test | |
- name: Docker build & push to dev | |
run: | | |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
docker build -t ${{ secrets.DOCKER_USERNAME }}/ice . | |
docker push ${{ secrets.DOCKER_USERNAME }}/ice | |
- name: Deploy to dev | |
uses: appleboy/ssh-action@master | |
id: deploy-dev | |
with: | |
host: ${{ secrets.HOST_DEV }} | |
username: ${{ secrets.USERNAME }} | |
port: 22 | |
key: ${{ secrets.PRIVATE_KEY }} | |
script: | | |
sudo docker stop $(docker ps -a -q) | |
sudo docker rm $(docker ps -a -q) | |
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/ice | |
sudo docker run -d -p 8080:8080 ${{ secrets.DOCKER_USERNAME }}/ice | |
sudo docker image prune -f |