Skip to content

Update main.yml

Update main.yml #8

Workflow file for this run

name: Deploy to Google Compute Engine
on:
push:
branches:
- main
env:
PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
GCE_INSTANCE: server-instance-name
GCE_INSTANCE_ZONE: instance-zone
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
# 인증 과정은 동일합니다.
- name: Setup gcloud CLI
uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ env.PROJECT_ID }}

Check failure on line 26 in .github/workflows/main.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/main.yml

Invalid workflow file

You have an error in your yaml syntax on line 26
- name: Auth to Google Cloud
uses: google-github-actions/[email protected]
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
secrets: inherit
# 소스 코드 압축
- name: Archive Source
run: tar -czvf source.tar.gz .
# Cloud Storage에 소스 코드 업로드
- name: Upload Source to Cloud Storage
run: |
gsutil cp source.tar.gz gs://your-bucket-name/${{ github.run_id }}/source.tar.gz
# GCE 인스턴스에서 소스 코드 다운로드 및 배포 스크립트 실행
- name: Deploy to GCE
run: |
gcloud compute ssh ${{ env.GCE_INSTANCE }} --zone ${{ env.GCE_INSTANCE_ZONE }} --command "\
wget https://storage.googleapis.com/your-bucket-name/${{ github.run_id }}/source.tar.gz -O /tmp/source.tar.gz && \
tar -xzvf /tmp/source.tar.gz -C /path/to/deployment/directory && \
sudo systemctl restart your-service-name"