Skip to content

Commit

Permalink
ci: release에 deploy 병합
Browse files Browse the repository at this point in the history
  • Loading branch information
Mincheol Kim authored Aug 2, 2020
1 parent 8f2d2b9 commit dd82559
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ on:
branches:
- master

env:
PROJECT_ID: ${{ secrets.GCE_PROJECT }}
GCE_INSTANCE: landlords-server
GCE_INSTANCE_ZONE: asia-northeast3-a

jobs:
release:
if: github.event.pull_request.merged == true
Expand Down Expand Up @@ -71,3 +76,31 @@ jobs:
repository: nexters/landlords-server
dockerfile: Dockerfile
tags: ${{ env.VERSION }}, latest

# Setup gcloud CLI
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
version: '290.0.1'
service_account_key: ${{ secrets.GCE_SA_KEY }}
project_id: ${{ secrets.GCE_PROJECT }}

# Configure Docker to use the gcloud command-line tool as a credential
# helper for authentication
- run: |-
gcloud --quiet auth configure-docker
# Build the Docker image
- name: Build
run: |-
docker build --tag "asia.gcr.io/$PROJECT_ID/$GCE_INSTANCE:${{ env.VERSION }}" .
# Push the Docker image to Google Container Registry
- name: Publish
run: |-
docker push "asia.gcr.io/$PROJECT_ID/$GCE_INSTANCE:${{ env.VERSION }}"
- name: Deploy
run: |-
gcloud compute instances update-container "$GCE_INSTANCE" \
--zone "$GCE_INSTANCE_ZONE" \
--container-image "asia.gcr.io/$PROJECT_ID/$GCE_INSTANCE:${{ env.VERSION }}"

0 comments on commit dd82559

Please sign in to comment.