Skip to content

πŸ’š[CI/CD] Update gradle.yml #3 #9

πŸ’š[CI/CD] Update gradle.yml #3

πŸ’š[CI/CD] Update gradle.yml #3 #9

Workflow file for this run

name: Java CI/CD with Gradle
on:
pull_request:
branches: ["develop"]
push:
branches: ["develop"]
jobs:
ci:
runs-on: ubuntu-lastest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Make application.yml
run: |
cd ./src/main/resources
touch ./application.yml
echo "${{ secrets.APPLICATION_YML }}" > ./application.yml
- name: Grant execute permission for gradlew and build
run: |
chmod +x ./gradlew
./gradlew clean
./gradlew build
cd:
runs-on: ubuntu-latest
needs: ci
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
# Docker image Build (2)
- name: Docker image build
run: docker build -t ${{ secrets.DOCKER_USERNAME }}/sponus-docker --pull --no-cache --platform linux/amd64 .
# DockerHub Login (3)
- name: Docker login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Docker Hub push (4)
- name: Docker Hub push
run: docker push ${{ secrets.DOCKER_USERNAME }}/sponus-docker
# AWS EC2 Server Connect & Docker command execution (8)
- name: Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }} # EC2 instance public DNS
username: ec2-user
key: ${{ secrets.PRIVATE_KEY }} # pem key
script: |

Check failure on line 69 in .github/workflows/gradle.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/gradle.yml

Invalid workflow file

You have an error in your yaml syntax on line 69
sudo docker stop sponus-docker
sudo docker rm sponus-docker
sudo docker rmi ${{ secrets.DOCKER_USERNAME }}/sponus-docker
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/sponus-docker
sudo docker stop my-redis
sudo docker rm my-redis
sudo docker rmi redis
sudo docker pull redis
sudo docker network create my-network
sudo docker run --name my-redis --network my-network -d redis
sudo docker run -it -d -p 8080:8080 --name sponus-docker -e TZ=Asia/Seoul --network my-network ${{ secrets.DOCKER_USERNAME }}/sponus-docker