Skip to content

Update actions/setup-node action to v4 #99

Update actions/setup-node action to v4

Update actions/setup-node action to v4 #99

Workflow file for this run

name: CI/CD
on:
push:
branches:
- main
- renovate/*
pull_request:
branches:
- main
- renovate/*
jobs:
CI:
name: Build and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://registry.npmjs.org/
cache: npm
- name: Install dependencies
run: npm ci
- name: Run ESLint
run: npx eslint . --max-warnings 0
- name: Run Prettier
run: npx prettier --check .
- name: Run CSpell
run: npx cspell **/*.*
- name: Run E2E Tests
uses: cypress-io/github-action@v4
with:
browser: chrome
install-command: npm ci
build: docker build . -t ci-build-image
start: docker run --rm -p 8080:80 ci-build-image
wait-on: http://localhost:8080
- uses: fossas/fossa-action@v1.3.1
with:
api-key: ${{ secrets.FOSSA_API_KEY }}
CD:
needs: CI
name: Deploy to Cloud Run
if: success() && github.ref == 'refs/heads/main'
environment:
name: Production
url: https://tobythe.dev
runs-on: ubuntu-latest
env:
IMAGE_NAME: gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_APP_NAME }}
steps:
- uses: actions/checkout@v4
- name: Login to GCP
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
- name: Set up GCP SDK
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
- name: Configure Docker
run: gcloud auth configure-docker --quiet
- name: Build Docker image
run: docker build . -t $IMAGE_NAME
- name: Push Docker image
run: docker push $IMAGE_NAME
- name: Deploy Docker image
run: gcloud run deploy ${{ secrets.GCP_APP_NAME }} --image $IMAGE_NAME --region europe-west1 --platform managed