Skip to content

Fix github action

Fix github action #6

name: Deploy to Google Compute Engine
on:
push:
branches:
- dev # Replace with your branch
jobs:
build-n-push:

Check failure on line 9 in .github/workflows/deploy-docker-gce.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/deploy-docker-gce.yml

Invalid workflow file

You have an error in your yaml syntax on line 9
runs-on: ubuntu-latest
steps:
uses: actions/checkout@v4
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: arcade0425
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and push Docker image
run: |
docker build -t arcade0425/snap_up_thsr:latest .
docker push arcade0425/snap_up_thsr:latest
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- uses: 'actions/checkout@v4'
- name: Google Cloud Auth
uses: google-github-actions/auth@v2
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
token_format: access_token
- name: Deploy to GCE
run: |
gcloud compute ssh ${{ secrets.GCP_USER }}@${{ secrets.GCP_INSTANCE }} --zone=${{ github.repository.INSTANCE_REGION }} -- "cd snap_up_thsr && \
docker pull arcade0425/snap_up_thsr:latest && \
docker run --network=${{ secrets.LIVE_NETWORK }} \
-p 8080:8000 \
-e REDIS_HOST=${{ secrets.REDIS_HOST }} \
-e DB_HOST=${{ secrets.DB_HOST }} \
-e DB_USER=${{ secrets.DB_USER }} \
-e DB_PASSWORD=${{ secrets.DB_PASSWORD }} \
-e DB_NAME=${{ secrets.DB_NAME }} \
-e deploy=live \
-d \
--restart=always \
--name snap_up_thsr \
arcade0425/snap_up_thsr:latest