Skip to content

fix: token error resolve #1

fix: token error resolve

fix: token error resolve #1

Workflow file for this run

name: Java CI with Gradle
on:
workflow_dispatch:
push:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Create application.yml
run: |
mkdir -p src/main/resources
echo "${{ secrets.APPLICATION_YML }}" > src/main/resources/application.yml
cat src/main/resources/application.yml
shell: bash
- name: Create Firebase service account file
uses: jsdaniell/create-json@v1.2.3
with:
name: "firebase-service-account.json"
json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
dir: "src/main/resources"
- name: Run chmod to make gradlew executable
run: chmod +x gradlew
- name: Gradle Build Action
uses: gradle/gradle-build-action@v2.6.0
with:
arguments: clean build
# ๊ฒฝ๋กœ ํ™•์ธ
- name: Verify JAR file
run: ls build/libs/*.jar
- name: Docker Login
uses: docker/login-action@v2.2.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker images
uses: docker/build-push-action@v4.1.1
with:
context: .
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/spring-boot-server
no-cache: true
- name: Deploy to AWS EC2
uses: appleboy/ssh-action@v0.1.10
with:
host: ${{ secrets.AWS_HOST_IP}}
username: ${{ secrets.AWS_HOST_USER }}
key: ${{ secrets.AWS_EC2_PRIVATE_KEY }}
script: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker pull ${{ secrets.DOCKER_USERNAME}}/spring-boot-server
docker stop $(docker ps -a -q)
docker run -d --log-driver=syslog -p 8080:8080 ${{ secrets.DOCKER_USERNAME }}/spring-boot-server
docker rm $(docker ps --filter 'status=exited' -a -q)
docker image prune -a -f