fix:팝콘작 선정 일요일 -> 월요일 변경 #105
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
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle | |
name: Java CI with Gradle | |
on: | |
push: | |
branches: [ "dev" ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v2 | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
- name: 환경 변수를 세팅합니다. | |
run: | | |
cd ./Infra/src/main/resources | |
sudo touch ./popcornmateprod-firebase-adminsdk-yvb81-02b4302a03.json | |
echo "$FIREBASE_JSON" | sudo tee ./popcornmateprod-firebase-adminsdk-yvb81-02b4302a03.json > /dev/null | |
sed -i 's/#/"/g' ./popcornmateprod-firebase-adminsdk-yvb81-02b4302a03.json | |
env: | |
FIREBASE_JSON: ${{ secrets.FCM_SECRET }} | |
- name: Build with Gradle | |
run: ./gradlew :Api:build | |
- name: Docker build | |
run: | | |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
docker build -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_DEV_REPO }} . | |
docker push ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_DEV_REPO }}:latest | |
- name: Deploy | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.EC2_DEV_HOST }} | |
username: ubuntu | |
key: ${{ secrets.EC2_DEV_KEY }} | |
script: | | |
cd Youngduck-Server | |
sudo touch .env | |
echo "${{ secrets.ENV }}" | sudo tee .env > /dev/null | |
cd Infra/src/main/resources | |
sudo touch popcornmate-d7ca1-firebase-adminsdk-svbpw-fce737e873.json | |
echo -ne "${{ secrets.FCM_SECRET }}" | sudo tee popcornmate-d7ca1-firebase-adminsdk-svbpw-fce737e873.json > /dev/null | |
docker stop $(docker ps -a -q) | |
docker rm $(docker ps -a -q) | |
docker rmi $(docker images -q) | |
docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_DEV_REPO }}:latest | |
docker-compose -f ~/Youngduck-Server/docker-compose.dev.yml --env-file ~/Youngduck-Server/.env up --build -d | |
docker image prune -a -f |