Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

deploy-server-dev

deploy-server-dev #358

name: ⭐️ Deploy PLATEAU Server dev
on:
workflow_dispatch:
repository_dispatch:
types: [deploy-server-dev]
env:
IMAGE: ghcr.io/eukarya-inc/reearth-plateauview/plateauview-api:latest
IMAGE_GCP: asia.gcr.io/reearth-plateau-dev/plateauview-api:latest
GCP_SERVICE_ACCOUNT: [email protected]
GCP_WORKLOAD_IDENTITY_PROVIDER: projects/383489516390/locations/global/workloadIdentityPools/github-actions-oidc/providers/github-provider
GCP_REGION: asia-northeast1
jobs:
deploy_server:
runs-on: ubuntu-latest
if: github.event.repository.full_name == 'eukarya-inc/reearth-plateauview'
permissions:
contents: read
id-token: write
packages: write
steps:
- uses: actions/checkout@v3
- uses: google-github-actions/auth@v0
with:
workload_identity_provider: ${{ env.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ env.GCP_SERVICE_ACCOUNT }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v0
- name: Configure docker
run: gcloud auth configure-docker --quiet
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download server arfiacts
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: ci.yml
workflow_conclusion: success
branch: main
name: plateauview-api
check_artifacts: true
- name: Unpack docker image
run: docker load < plateauview-api.tar.gz
- name: docker push
run: |
docker tag $IMAGE $IMAGE_GCP && \
docker push $IMAGE &&
docker push $IMAGE_GCP
- name: Deploy server to Cloud Run
run: |
gcloud run deploy plateauview-api \
--image $IMAGE_GCP \
--region $GCP_REGION \
--platform managed \
--quiet