Skip to content

CD

CD #108

Workflow file for this run

name: CD
on:
workflow_dispatch:
permissions: read-all
jobs:
dev_deploy:
name: Build and Deploy to Production
if: ${{ github.repository == 'sws2apps/cpe-sws' && github.ref == 'refs/heads/main' }}
environment:
name: Production
url: https://cpe-web.sws2apps.app
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: Checkout for release preparation
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
with:
ref: main
persist-credentials: false
- name: Use Node.js LTS version
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d
with:
node-version: lts/Hydrogen
- name: Install package dependencies
run: npm ci
- name: Run Semantic Release to version and build App
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
VITE_FINGERPRINT_API_CLIENT_KEY: ${{ secrets.VITE_FINGERPRINT_API_CLIENT_KEY }}
VITE_FIREBASE_APIKEY: ${{ secrets.VITE_FIREBASE_APIKEY }}
VITE_FIREBASE_AUTHDOMAIN: ${{ secrets.VITE_FIREBASE_AUTHDOMAIN }}
VITE_FIREBASE_PROJECTID: ${{ vars.VITE_FIREBASE_PROJECTID }}
VITE_FIREBASE_APPID: ${{ secrets.VITE_FIREBASE_APPID }}
VITE_FIREBASE_MEASUREMENTID: ${{ secrets.VITE_FIREBASE_MEASUREMENTID }}
- name: Check if new version has been generated
id: check_build
uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b
with:
files: 'dist'
- name: Deploy to Firebase
if: ${{ steps.check_build.outputs.files_exists == 'true' }}
uses: sws2apps/firebase-deployment@11da74219abba8bc5bc318d8cd403115181e4534
with:
workloadIdentityProvider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
serviceAccount: ${{ secrets.SERVICE_ACCOUNT }}
project: cpe-sws