Deploy Client through ci/cd. #26
Workflow file for this run
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: Client CI/CD | ||
on: | ||
push: | ||
paths: | ||
- 'client/**' | ||
- '.github/workflows/client.yaml*' | ||
defaults: | ||
run: | ||
working-directory: client | ||
env: | ||
GOOGLE_CREDENTIALS: ${{ secrets.GCP_CD }} | ||
REGION: 'us-west2' | ||
PROJECT: "artist-2d" | ||
SERVICE_NAME: "artist-2d-client" | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/main' | ||
strategy: | ||
matrix: | ||
node-version: [20.x] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: npm ci | ||
- run: npm run build --if-present | ||
env: | ||
NODE_OPTIONS: "--openssl-legacy-provider" | ||
- run: npm test | ||
deploy-gcr: | ||
name: Deploy to GCR | ||
#needs: build | ||
runs-on: ubuntu-latest | ||
#if: github.ref == 'refs/heads/main' | ||
env: | ||
IMAGE_TAG: "gcr.io/${{ env.PROJECT }}/client:${GITHUB_SHA}" | ||
Check failure on line 47 in .github/workflows/client.yaml GitHub Actions / Client CI/CDInvalid workflow file
|
||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@main | ||
- run: echo "${IMAGE_TAG}" | ||
- run: echo "${{ env.IMAGE_TAG }}" | ||
- run: echo "${PROJECT}" | ||
- run: echo "${{ env.PROJECT }}" | ||
- uses: 'actions/checkout@v4' | ||
- name: Setup GCloud Auth | ||
id: auth | ||
uses: google-github-actions/auth@v2 | ||
with: | ||
credentials_json: ${{ secrets.GCP_CD }} | ||
- name: Set up Cloud SDK | ||
uses: google-github-actions/setup-gcloud@v2 | ||
# Build and push image to Google Container Registry | ||
- name: Build & Push | ||
run: gcloud builds submit --tag ${IMAGE_TAG} | ||
# Deploy image to Cloud Run | ||
- name: Deploy GCR | ||
run: |- | ||
gcloud run deploy "$SERVICE_NAME" \ | ||
--quiet \ | ||
--region "${REGION}" \ | ||
--image "${{ env.IMAGE_TAG }}" \ | ||
--platform "managed" \ | ||
--allow-unauthenticated |