fix: remotePattern에 prod url 추가 #395
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: Deploy | |
on: | |
push: | |
branches: | |
- main | |
- qa2 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v3.8.0 | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Log in to the Container Registry | |
uses: docker/login-action@v2.2.0 | |
with: | |
registry: ghcr.io | |
username: ${{github.actor}} | |
password: ${{secrets.GITHUB_TOKEN}} | |
- name: Create .env file | |
run: | | |
echo "NEXT_PUBLIC_KAKAO_MAP_API_KEY=${{secrets.KAKAO_MAP_API_KEY}}" > .env.local | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v4.1.1 | |
with: | |
context: '.' | |
push: true | |
tags: | | |
ghcr.io/wafflestudio/csereal_nextjs_image:latest | |
ghcr.io/wafflestudio/csereal_nextjs_image:${{github.sha}} | |
- name: executing remote ssh commands using password | |
uses: appleboy/ssh-action@v1.0.3 | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USER }} | |
key: ${{ secrets.SSH_KEY }} | |
script: | | |
docker stop csereal_nextjs_image | |
docker rm csereal_nextjs_image | |
docker pull ghcr.io/wafflestudio/csereal_nextjs_image:latest | |
docker run -d -p 3000:3000 --name csereal_nextjs_image ghcr.io/wafflestudio/csereal_nextjs_image |