docs: edit readme #41
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: | |
- master | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'corretto' | |
package: 'jdk' | |
jdk-version: '11.0.20' | |
- name: checkout | |
uses: actions/checkout@master | |
- name: create env and secure file | |
run: | | |
touch .env | |
echo "${{ secrets.ENV_VARS }}" >> .env | |
cd src/main/resources | |
touch secure.properties | |
echo "${{ secrets.SECURE_VARS }}" >> secure.properties | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Build with Gradle | |
run: ./gradlew clean build | |
- name: Image build and push | |
run: | | |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
docker-compose -f docker-compose-prod.yml build | |
docker push minuooooo/greeny_app | |
- name: Up docker-compose | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.EC2_HOST }} | |
username: ${{ secrets.EC2_USERNAME }} | |
password: ${{ secrets.EC2_PASSWORD }} | |
script: | | |
sudo docker stop ubuntu_app_1 | |
sudo docker rm ubuntu_app_1 | |
sudo docker rmi minuooooo/greeny_app | |
sudo docker pull minuooooo/greeny_app | |
sudo docker-compose -f docker-compose-prod.yml up -d |