Skip to content

⭐️ Deploy CMS dev #20

⭐️ Deploy CMS dev

⭐️ Deploy CMS dev #20

name: ⭐️ Deploy CMS dev
on:
workflow_call:
workflow_dispatch:
env:
CMS_IMAGE_NAME: reearth/reearth-cms:rc
CMS_IMAGE_NAME_GHCR: ghcr.io/eukarya-inc/plateau-view/reearth-cms:latest
CMS_IMAGE_NAME_GCP: asia-northeast1-docker.pkg.dev/reearth-plateau-dev/reearth-plateau/reearth-cms:latest
CMS_WEB_IMAGE_NAME: reearth/reearth-cms-web:rc
CMS_WEB_IMAGE_NAME_GHCR: ghcr.io/eukarya-inc/plateau-view/reearth-cms-web:latest
CMS_WEB_IMAGE_NAME_GCP: asia-northeast1-docker.pkg.dev/reearth-plateau-dev/reearth-plateau/reearth-cms-web:latest
CMS_WORKER_IMAGE_NAME: reearth/reearth-cms-worker:rc
CMS_WORKER_IMAGE_NAME_GHCR: ghcr.io/eukarya-inc/plateau-view/reearth-cms-worker:latest
CMS_WORKER_IMAGE_NAME_GCP: asia-northeast1-docker.pkg.dev/reearth-plateau-dev/reearth-plateau/reearth-cms-worker:latest
concurrency:
group: ${{ github.workflow }}
jobs:
deploy_web:
runs-on: ubuntu-latest
environment: dev
permissions:
contents: read
id-token: write
packages: write
if: github.event.repository.full_name == 'eukarya-inc/PLATEAU-VIEW'
steps:
- uses: google-github-actions/auth@v2
with:
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
- 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 images
run: docker pull $CMS_WEB_IMAGE_NAME
- name: Tag docker images
run: |
docker tag $CMS_WEB_IMAGE_NAME $CMS_WEB_IMAGE_NAME_GHCR
docker tag $CMS_WEB_IMAGE_NAME $CMS_WEB_IMAGE_NAME_GCP
- name: Push docker images
run: |
docker push $CMS_WEB_IMAGE_NAME_GHCR
docker push $CMS_WEB_IMAGE_NAME_GCP
- name: Deploy
run: |
gcloud run deploy reearth-cms-web \
--image $CMS_WEB_IMAGE_NAME_GCP \
--region ${{ vars.GCP_REGION }} \
--platform managed \
--quiet
deploy_server_worker:
runs-on: ubuntu-latest
environment: dev
permissions:
contents: read
id-token: write
packages: write
if: github.event.repository.full_name == 'eukarya-inc/PLATEAU-VIEW'
steps:
- uses: google-github-actions/auth@v2
with:
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
- 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 images
run: docker pull $CMS_IMAGE_NAME && docker pull $CMS_WORKER_IMAGE_NAME
- name: Tag docker images
run: |
docker tag $CMS_IMAGE_NAME $CMS_IMAGE_NAME_GHCR && \
docker tag $CMS_IMAGE_NAME $CMS_IMAGE_NAME_GCP && \
docker tag $CMS_WORKER_IMAGE_NAME $CMS_WORKER_IMAGE_NAME_GHCR && \
docker tag $CMS_WORKER_IMAGE_NAME $CMS_WORKER_IMAGE_NAME_GCP
- name: Push docker images
run: |
docker push $CMS_IMAGE_NAME_GHCR && \
docker push $CMS_IMAGE_NAME_GCP && \
docker push $CMS_WORKER_IMAGE_NAME_GHCR && \
docker push $CMS_WORKER_IMAGE_NAME_GCP
- name: Deploy
run: |
gcloud run deploy reearth-cms-api \
--image $CMS_IMAGE_NAME_GCP \
--region ${{ vars.GCP_REGION }} \
--platform managed \
--quiet
gcloud run deploy reearth-cms-worker \
--image $CMS_WORKER_IMAGE_NAME_GCP \
--region ${{ vars.GCP_REGION }} \
--platform managed \
--quiet
e2e_web:
needs: [deploy_web, deploy_server_worker]
if: needs.deploy_web.result == 'success' && needs.deploy_server_worker.result == 'success'
uses: ./.github/workflows/e2e-cms-web.yml
with:
api_url: ${{ vars.REEARTH_PLATEAU_CMS_DEV_API_URL }}
base_url: ${{ vars.REEARTH_PLATEAU_CMS_DEV_BASE_URL }}
secrets:
REEARTH_E2E_USERNAME: ${{ secrets.REEARTH_PLATEAU_DEV_E2E_USERNAME }}
REEARTH_E2E_PASSWORD: ${{ secrets.REEARTH_PLATEAU_DEV_E2E_PASSWORD }}