[K-SC] 소켓 연결 및 whoAmI 이벤트 등록 성공 #1091
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: CI/CD | |
on: | |
push: | |
branches: ['main', 'develop'] | |
pull_request: | |
branches: ['main', 'develop'] | |
types: ['opened', 'reopened', 'synchronize', 'closed'] | |
jobs: | |
CI: | |
name: Are You Ready? 😃 | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Checkout 🏁 | |
uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
- name: Check current directory | |
run: | | |
echo "Current directory:" | |
pwd | |
echo "Directory content:" | |
ls -la | |
- name: Change to project dic | |
run: cd /home/runner/work/Peer-Frontend/Peer-Frontend | |
- name: Install packages | |
run: npm i /home/runner/work/Peer-Frontend/Peer-Frontend | |
- name: Prettier | |
working-directory: /home/runner/work/Peer-Frontend/Peer-Frontend | |
run: npm run format | |
- name: Lint | |
working-directory: /home/runner/work/Peer-Frontend/Peer-Frontend | |
run: npm run lint | |
- name: Build Test | |
working-directory: /home/runner/work/Peer-Frontend/Peer-Frontend | |
run: npm run build | |
CD: | |
name: Deployment | |
if: github.ref == 'refs/heads/develop' && (github.event.pull_request.merged == true || github.event_name == 'push') | |
runs-on: ubuntu-latest | |
needs: CI | |
steps: | |
- name: Checkout 🏁 | |
uses: actions/checkout@v2 | |
- name: Build and push Docker image | |
run: | | |
touch /home/runner/work/Peer-Frontend/Peer-Frontend/.env.production | |
echo "${{ secrets.ENV_FILE }}" >> /home/runner/work/Peer-Frontend/Peer-Frontend/.env.production | |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | |
docker build -f Dockerfile -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_DEV_IMAGE }} . | |
docker push ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_DEV_IMAGE }} | |
- name: Deploy | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.DEV_HOST }} | |
port: 22 | |
username: ${{ secrets.DEV_USERNAME }} | |
key: ${{ secrets.DEV_KEY }} | |
script: | | |
docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_DEV_IMAGE }} | |
docker rm -f $(docker ps -qa) | |
docker run -d -p 80:3000 ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_DEV_IMAGE }} | |
docker container prune -f | |
docker image prune -f |