Refactor link creation process, enhance memory management, and update… #50
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: Build and Deploy to GCP VM | |
on: | |
push: | |
branches: | |
- main # 또는 배포하려는 브랜치 명시 | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Authenticate gcloud CLI | |
uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: ${{ secrets.GCP_SA_KEY }} | |
- name: Set up Cloud SDK | |
uses: google-github-actions/setup-gcloud@v2 | |
with: | |
project_id: ${{ secrets.GCP_PROJECT }} | |
install_components: "kubectl" | |
- name: Build the project | |
run: | | |
# 빌드 명령 실행, 예: make, gcc, g++, javac 등 | |
echo "Building the project..." | |
# 여기에 빌드 명령을 추가하세요 | |
- name: 실행 중인 main 중지 | |
run: | | |
echo "Running deployment script on VM..." | |
gcloud compute ssh ${{ secrets.VM_NAME }} --zone ${{ secrets.VM_ZONE }} --command 'sudo pkill -f main' | |
- name: Copy files to GCP VM | |
run: | | |
echo "Deploying to Google Cloud VM..." | |
gcloud compute scp ./main ${{ secrets.VM_NAME }}:~/ --zone ${{ secrets.VM_ZONE }} | |
gcloud compute scp ./index2.html ${{ secrets.VM_NAME }}:~/ --zone ${{ secrets.VM_ZONE }} | |
gcloud compute scp ./main.cpp ${{ secrets.VM_NAME }}:~/ --zone ${{ secrets.VM_ZONE }} | |
# gcloud compute scp ./order3-test.bin ${{ secrets.VM_NAME }}:~/ --zone ${{ secrets.VM_ZONE }} | |
- name: Execute deployment script on VM | |
run: | | |
echo "Running deployment script on VM..." | |
gcloud compute ssh ${{ secrets.VM_NAME }} --zone ${{ secrets.VM_ZONE }} --command 'chmod +x main' | |
gcloud compute ssh ${{ secrets.VM_NAME }} --zone ${{ secrets.VM_ZONE }} --command './main > /dev/null 2>&1 &' |