CLAP-427 QA ์ฌํญ ๋ฐ์ Chloe #5
Workflow file for this run
This file contains hidden or 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
| # github repository actions ํ์ด์ง์ ๋ํ๋ ์ด๋ฆ | |
| name: CD for front using github actions | |
| on: | |
| pull_request: | |
| types: [ closed ] | |
| branches: [ "develop" ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| front-cd: | |
| if: github.event.pull_request.merged == true | |
| runs-on: ubuntu-latest | |
| steps: | |
| # ์ ์ฅ์ ์ฝ๋๋ฅผ ์ฒดํฌ์์ํฉ๋๋ค. (PR ์ฌ๋ฆฐ ์ฝ๋๋ฅผ ๊ฐ์ ธ์ค๋ ํ์) | |
| - uses: actions/checkout@v4 | |
| # Node.js ํ๊ฒฝ ์ค์ | |
| - name: Use Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 # ์ง์ ๋ Node.js ๋ฒ์ ์ฌ์ฉ | |
| cache: npm # setup-node ์ ์บ์ ๊ธฐ๋ฅ์ ์ฌ์ฉํจ | |
| cache-dependency-path: package-lock.json # ์บ์ ๊ธฐ๋ฅ์ ์ฌ์ฉํ ๋ ์บ์์ ๊ธฐ์ค์ด ๋ ํ์ผ์ ์ง์ | |
| - name: Install Dependencies | |
| run: npm install | |
| - name: Build with npm | |
| run: npm run build-only | |
| - name: Create nginxfile.conf | |
| run: touch ./nginxfile.conf | |
| - run: echo "${{ secrets.NGINX_FILE_CONF }}" > ./nginxfile.conf | |
| - name: Create Develop nginx.conf | |
| run: touch ./nginx.conf | |
| - run: echo "${{ secrets.NGINX_CONF }}" > ./nginx.conf | |
| # docker build & push to develop | |
| - name: Docker build & push develop | |
| run: | | |
| docker login clap.kr-central-2.kcr.dev -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
| docker build -t ${{ secrets.DOCKER_FRONT_REPO }} . | |
| docker push ${{ secrets.DOCKER_FRONT_REPO }} | |
| # deploy | |
| - name: Deploy Develop | |
| uses: appleboy/ssh-action@master | |
| id: deployDevelop | |
| with: | |
| host: ${{ secrets.FRONT_HOST }} | |
| username: ${{ secrets.FRONT_HOST_USERNAME }} | |
| key: ${{ secrets.FRONT_HOST_KEY }} | |
| port: ${{ secrets.FRONT_HOST_PORT }} | |
| script: | | |
| docker rm -f taskflow-front | |
| docker image rm -f ${{ secrets.DOCKER_FRONT_REPO }} | |
| docker run --name taskflow-front -d -p 80:80 -p 443:443 -v /etc/letsencrypt/:/etc/letsencrypt/ -v /etc/ssl/:/etc/ssl/ --restart on-failure ${{ secrets.DOCKER_FRONT_REPO }} |