[Feature] 알림 생성, CODEF 주카드 등록 #73
Workflow file for this run
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: CD with Gradle | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
branches: | |
- main | |
- develop | |
permissions: | |
contents: read | |
jobs: | |
build-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: "adopt" | |
- name: Make application.properties & Firebase Service Account Key | |
run: | | |
cd ./src/main/resources | |
touch ./application.properties | |
echo "${{ secrets.PROPERTIES }}" > ./application.properties | |
touch ./firebase/once-firebase-adminsdk.json | |
echo "${{ secrets.ONCE_FIREBASE_ADMINSDK }}" > ./firebase/once-firebase-adminsdk.json | |
shell: bash | |
- name: Build with Gradle | |
run: | | |
chmod +x ./gradlew | |
./gradlew clean build -x test | |
deploy-to-Server: | |
if: github.event_name == 'push' | |
name: Deploy | |
runs-on: ubuntu-latest | |
needs: build-test | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: "adopt" | |
- name: Make application.properties & Firebase Service Account Key | |
run: | | |
cd ./src/main/resources | |
touch ./application.properties | |
echo "${{ secrets.PROPERTIES }}" > ./application.properties | |
touch ./firebase/once-firebase-adminsdk.json | |
echo "${{ secrets.ONCE_FIREBASE_ADMINSDK }}" > ./firebase/once-firebase-adminsdk.json | |
shell: bash | |
- name: Build with Gradle | |
run: | | |
chmod +x ./gradlew | |
./gradlew clean build -x test | |
- name: Docker build & push to prod | |
run: | | |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin | |
# docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
# docker build -f Dockerfile -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }} . | |
docker build -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }} . | |
docker push ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }} | |
- name: Deploy start | |
uses: appleboy/ssh-action@v0.1.4 | |
id: deploy | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.SERVER_USER }} | |
key: ${{ secrets.KEY }} | |
envs: GITHUB_SHA | |
script: | | |
sudo docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
sudo docker rm -f $(docker ps -qa) | |
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }} | |
docker-compose up -d | |
docker image prune -f |