-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fe4dea3
commit 8bb347a
Showing
5 changed files
with
164 additions
and
116 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: CD-Manual-Frontend-Deploy | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
branches: ['feat_system_cicd_enhancment'] | ||
inputs: | ||
version: | ||
description: 'current deploy version' | ||
required: true | ||
default: '0.0.1' | ||
|
||
jobs: | ||
frontend: | ||
permissions: | ||
contents: 'read' | ||
id-token: 'write' | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Production Code | ||
uses: 'actions/checkout@v3' | ||
|
||
- name: Authenticate to Google Cloud | ||
id: auth | ||
uses: 'google-github-actions/auth@v1' | ||
with: | ||
token_format: access_token | ||
workload_identity_provider: '${{ secrets.WIF_PROVIDER }}' | ||
service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}' | ||
access_token_lifetime: 900s | ||
|
||
## artifact registry auth setup | ||
- name: Login to Artifact Registry | ||
id: docker-auth | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ${{ vars.GAR_LOCATION }}-docker.pkg.dev | ||
username: oauth2accesstoken | ||
password: ${{ steps.auth.outputs.access_token }} | ||
|
||
- name: Deploy to Cloud Run | ||
id: deploy | ||
uses: google-github-actions/deploy-cloudrun@v0 | ||
with: | ||
service: ${{ vars.FRONTEND_SERVICE }} | ||
region: ${{ vars.REGION }} | ||
image: ${{ vars.GAR_LOCATION }}-docker.pkg.dev/${{ vars.PROJECT_ID }}/${{ vars.REPOSITORY }}/${{ vars.FRONTEND_SERVICE }}:${{ inputs.version }} | ||
## set --max-old-space-size=8192 for node.js to increase memory limit | ||
env_vars: | | ||
ENV=${{ vars.ENV }} | ||
STAGE_SERVER=${{ vars.ENV }}_SERVER | ||
NODE_OPTIONS=${{ vars.NODE_OPTIONS }} | ||
- name: Allow public access | ||
id: unauthenticated | ||
run: gcloud run services add-iam-policy-binding ${{ vars.FRONTEND_SERVICE }} --region=${{ vars.REGION }} --member="allUsers" --role="roles/run.invoker" | ||
|
||
- name: Show Output | ||
run: echo ${{ steps.deploy.outputs.url }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: CD-Manual-Relay-Deploy | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
branches: ['feat_system_cicd_enhancment'] | ||
inputs: | ||
version: | ||
description: 'current deploy version' | ||
required: true | ||
default: '0.0.1' | ||
|
||
jobs: | ||
relay: | ||
permissions: | ||
contents: 'read' | ||
id-token: 'write' | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Production Code | ||
uses: 'actions/checkout@v3' | ||
|
||
- name: Authenticate to Google Cloud | ||
id: auth | ||
uses: 'google-github-actions/auth@v1' | ||
with: | ||
token_format: access_token | ||
workload_identity_provider: '${{ secrets.WIF_PROVIDER }}' | ||
service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}' | ||
access_token_lifetime: 300s | ||
|
||
## artifact registry auth setup | ||
- name: Login to Artifact Registry | ||
id: docker-auth | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ${{ vars.GAR_LOCATION }}-docker.pkg.dev | ||
username: oauth2accesstoken | ||
password: ${{ steps.auth.outputs.access_token }} | ||
|
||
- name: Deploy to Cloud Run | ||
id: deploy | ||
uses: google-github-actions/deploy-cloudrun@v0 | ||
with: | ||
service: ${{ vars.BACKEND_SERVICE }} | ||
region: ${{ vars.REGION }} | ||
image: ${{ vars.GAR_LOCATION }}-docker.pkg.dev/${{ vars.PROJECT_ID }}/${{ vars.REPOSITORY }}/${{ vars.BACKEND_SERVICE }}:${{ inputs.version }} | ||
# add ENV as below | ||
env_vars: | | ||
TWITTER_CLIENT_ID=${{ secrets.TWITTER_CLIENT_ID }} | ||
TWITTER_CLIENT_KEY=${{ secrets.TWITTER_CLIENT_KEY }} | ||
CLIENT_URL=${{ vars.CLIENT_URL }} | ||
CALLBACK_URL=${{ vars.CALLBACK_URL }} | ||
- name: Allow public access | ||
id: unauthenticated | ||
run: gcloud run services add-iam-policy-binding ${{ vars.BACKEND_SERVICE }} --region=${{ vars.REGION }} --member="allUsers" --role="roles/run.invoker" | ||
|
||
- name: Show Output | ||
run: echo ${{ steps.deploy.outputs.url }} |
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