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

⭐️ Deploy PLATEAU Server production #167

⭐️ Deploy PLATEAU Server production

⭐️ Deploy PLATEAU Server production #167

name: ⭐️ Deploy PLATEAU Server production
on:
workflow_dispatch:
env:
IMAGE: ghcr.io/eukarya-inc/reearth-plateauview/plateauview-api:latest
IMAGE_GCP: asia.gcr.io/reearth-plateau/plateauview-api:latest
IMAGE_HUB: eukarya/plateauview2-sidecar:latest
GCP_SERVICE_ACCOUNT: [email protected]
GCP_WORKLOAD_IDENTITY_PROVIDER: projects/232353765693/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: read
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: Pull docker image from GHCR
run: docker pull $IMAGE
- name: docker push
run: |
docker tag $IMAGE $IMAGE_GCP
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
push_hub:
runs-on: ubuntu-latest
permissions:
packages: read
steps:
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull image
run: docker pull $IMAGE
- name: Log in to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Push image
run: docker tag $IMAGE $IMAGE_HUB && docker push $IMAGE_HUB