-
Notifications
You must be signed in to change notification settings - Fork 3
68 lines (67 loc) · 2.24 KB
/
deploy-server-prod.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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