[PUBLIC] Dropdown 메뉴 재사용성 증가 #63
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: Test server CI/CD | |
on: | |
push: | |
branches: ['main', 'develop'] | |
pull_request: | |
branches: ['main', 'develop'] | |
types: ['opened', 'reopened', 'synchronize', 'closed'] | |
jobs: | |
CI: | |
name: Test CI!! 😃 | |
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: Test CD 👻 | |
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_TEST_IMAGE }} . | |
docker push ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_DEV_TEST_IMAGE }} | |
- name: Deploy | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.DEV_TEST_HOST }} | |
port: 22 | |
username: ${{ secrets.DEV_TEST_USERNAME }} | |
password: ${{ secrets.DEV_TEST_KEY }} | |
script: | | |
docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_DEV_TEST_IMAGE }} | |
docker rm -f ${{ secrets.DOCKER_DEV_TEST_IMAGE }} | |
docker run -d -p 3000:3000 ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_DEV_TEST_IMAGE }} | |
docker container prune -f | |
docker image prune -f |