mirror of
https://github.com/netlight/my-finance-pal-backend.git
synced 2024-11-12 17:44:15 +01:00
56 lines
1.3 KiB
YAML
56 lines
1.3 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
build_and_test:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '18'
|
|
|
|
- name: Install dependencies
|
|
run: yarn install
|
|
|
|
- name: Build application
|
|
run: yarn build
|
|
|
|
- name: Run unit tests
|
|
run: yarn test:unit
|
|
|
|
cloud_build:
|
|
needs: build_and_test
|
|
runs-on: ubuntu-latest
|
|
if: ${{ github.event_name == 'push' }}
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Authenticate with Google Cloud
|
|
uses: google-github-actions/auth@v1
|
|
with:
|
|
credentials_json: '${{ secrets.GCP_SA_KEY }}'
|
|
|
|
- name: Setup gcloud CLI
|
|
uses: google-github-actions/setup-gcloud@v1
|
|
with:
|
|
project_id: ${{ secrets.GCP_PROJECT_ID }}
|
|
|
|
- name: Submit job to Cloud Build
|
|
run: |
|
|
gcloud builds submit \
|
|
--region ${{ secrets.GCP_REGION }} \
|
|
--config cloudbuild.yaml \
|
|
--substitutions=_FULL_IMAGE_NAME=${{ secrets.GCP_REGION }}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/cloud-run-builds/my-finance-pal,_IMAGE_TAG=${{ github.sha }} \
|
|
.
|