⭐️ Deploy PLATEAU Server production #45
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ⭐️ Deploy PLATEAU Server production | |
on: | |
workflow_dispatch: | |
env: | |
IMAGE: ghcr.io/eukarya-inc/plateau-view-3.0/plateauview-api:latest | |
IMAGE_GCP: asia-northeast1-docker.pkg.dev/reearth-plateau/reearth-plateau/plateauview-api:latest | |
IMAGE_HUB: eukarya/plateauview2-sidecar:latest | |
jobs: | |
deploy_server: | |
runs-on: ubuntu-latest | |
if: github.event.repository.full_name == 'eukarya-inc/PLATEAU-VIEW-3.0' | |
environment: prod | |
permissions: | |
contents: read | |
id-token: write | |
packages: read | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: google-github-actions/auth@v2 | |
with: | |
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} | |
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} | |
- name: Set up Cloud SDK | |
uses: google-github-actions/setup-gcloud@v2 | |
- name: Configure docker | |
run: gcloud auth configure-docker asia-northeast1-docker.pkg.dev --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 | |
env: | |
GCP_REGION: ${{ vars.GCP_REGION }} | |
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 |