✨ 이벤트 확정 시 finished로 마킹하고, finished 마킹된 이벤트는 보이지 않도록 수정 #100
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
| name: Deploy via SSH | |
| on: | |
| push: | |
| branches: [main] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - id: string | |
| uses: ASzc/change-string-case-action@v6 | |
| with: | |
| string: ${{ github.event.repository.name }} | |
| - name: Checkout source code | |
| uses: actions/checkout@v4 | |
| - name: Build Docker Image | |
| run: | | |
| docker build --tag ${{ steps.string.outputs.lowercase }} . | |
| - name: Docker image to tar file | |
| run: | | |
| docker save ${{ steps.string.outputs.lowercase }} | gzip > ${{ steps.string.outputs.lowercase }}.tar.gz | |
| - name: Set up SSH | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 | |
| chmod 600 ~/.ssh/id_ed25519 | |
| ssh-keyscan -p ${{ secrets.SSH_PORT }} -H ${{ secrets.SSH_IP }} >> ~/.ssh/known_hosts | |
| - name: Deploy on Remote Server | |
| run: | | |
| rsync -e 'ssh -p ${{ secrets.SSH_PORT }}' -avz --delete ./${{ steps.string.outputs.lowercase }}.tar.gz ${{ secrets.SSH_USER }}@${{ secrets.SSH_IP }}:/deploy | |
| ssh -l ${{ secrets.SSH_USER }} -p ${{ secrets.SSH_PORT }} ${{ secrets.SSH_IP }} << 'EOF' | |
| cd /deploy | |
| docker load < ${{ steps.string.outputs.lowercase }}.tar.gz | |
| docker stop ${{ steps.string.outputs.lowercase }} | |
| docker run -d --rm --name ${{ steps.string.outputs.lowercase }} -v /images:/images -p 10001:3000 --env-file .env.${{ steps.string.outputs.lowercase }} ${{ steps.string.outputs.lowercase }} | |
| EOF |