allow multiple region deployment #4
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: Node.js Cloud Run Deploy | |
on: | |
workflow_call: | |
inputs: | |
service: | |
type: string | |
default: ${{ github.event.repository.name }} | |
regions: | |
type: array | |
default: ['us-east1'] | |
ingress: | |
type: string | |
default: all | |
execution-environment: | |
type: string | |
default: gen2 | |
cpu: | |
type: number | |
default: 0.1 | |
memory: | |
type: string | |
default: 256Mi | |
min-instances: | |
type: number | |
default: 0 | |
max-instances: | |
type: number | |
default: 10 | |
concurrency: | |
type: number | |
default: 100 | |
timeout: | |
type: number | |
default: 60 | |
cloud-sql: | |
type: boolean | |
default: false | |
deploy-args: | |
type: string | |
env: | |
NPM_TOKEN: ${{ secrets.GLB_NPM_TOKEN }} | |
jobs: | |
prepare: | |
name: Prepare Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- name: Download Environment File | |
uses: actions/download-artifact@v4 | |
continue-on-error: true | |
with: | |
name: environment-file | |
- name: Install Dependencies | |
run: | | |
npm i -g pnpm | |
pnpm i --frozen-lockfile | |
- name: Run Lint Check | |
run: pnpm lint | |
- name: Run Unit Test | |
run: pnpm test | |
- name: Upload Test Coverage | |
uses: actions/upload-artifact@v4 | |
continue-on-error: true | |
with: | |
name: test-coverage | |
path: | | |
coverage | |
test-report.xml | |
- name: Run Code Build | |
run: pnpm build | |
- name: Upload Build Artifacts | |
uses: actions/upload-artifact@v4 | |
continue-on-error: true | |
with: | |
name: build-artifacts | |
path: dist | |
deploy: | |
name: Cloud Run Deploy | |
uses: ./.github/workflows/gcp_cloud_run_deploy.yaml | |
secrets: inherit | |
needs: prepare | |
with: | |
service: ${{ inputs.service }} | |
regions: ${{ inputs.regions }} | |
ingress: ${{ inputs.ingress }} | |
execution-environment: ${{ inputs.execution-environment }} | |
cpu: ${{ inputs.cpu }} | |
memory: ${{ inputs.memory }} | |
max-instances: ${{ inputs.max-instances }} | |
min-instances: ${{ inputs.min-instances }} | |
concurrency: ${{ inputs.concurrency }} | |
timeout: ${{ inputs.timeout }} | |
cloud-sql: ${{ inputs.cloud-sql }} | |
deploy-args: ${{ inputs.deploy-args }} |