Skip to content

Fixed maps and Google SSO, Updated iOS SSO logic. #455

Fixed maps and Google SSO, Updated iOS SSO logic.

Fixed maps and Google SSO, Updated iOS SSO logic. #455

# Nonprofit Social Networking Platform: Allowing Users and Organizations to Collaborate.
# Copyright (C) 2023 ASCENDynamics NFP
# This file is part of Nonprofit Social Networking Platform.
# Nonprofit Social Networking Platform is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Nonprofit Social Networking Platform is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
# You should have received a copy of the GNU Affero General Public License
# along with Nonprofit Social Networking Platform. If not, see <https://www.gnu.org/licenses/>.
name: CI and PR Deployment
on:
pull_request:
branches:
- main # Trigger workflow on pull requests targeting the main branch
jobs:
# Linting job
lint:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository
- uses: actions/checkout@v4
# Step 2: Set up Node.js environment
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '22'
# Step 3: Install dependencies
- name: Install dependencies
run: npm ci --legacy-peer-deps
# Step 4: Run linting
- name: Run lint
run: npm run lint
# Build and test job
build-and-test:
runs-on: ubuntu-latest
# needs: lint # This job depends on the successful completion of the lint job
steps:
# Step 1: Checkout the repository
- uses: actions/checkout@v4
# Step 2: Set up Node.js environment
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '22'
# Step 2.5: Set up Java for Firebase emulators
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
# Step 3: Cache node modules
- name: Cache node modules
uses: actions/cache@v3
with:
path: |
~/.npm # NPM cache directory
node_modules # Root node_modules
functions/node_modules # Functions node_modules
key: ${{ runner.os }}-node-22-${{ hashFiles('package-lock.json', 'functions/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-22-
# Step 4: Install dependencies
- name: Install dependencies
run: |
npm ci --legacy-peer-deps # Install root project dependencies
npm --prefix functions ci # Install functions dependencies
- name: Install Angular CLI, Firebase CLI and Chrome
run: |
npm install -g @angular/cli
npm install -g firebase-tools
sudo apt-get update
sudo apt-get install -y chromium-browser
# Step 5: Set environment variables
- name: Set environment variables
run: |
echo "CI=true" >> $GITHUB_ENV
echo "NODE_ENV=development" >> $GITHUB_ENV
echo "FIREBASE_API_KEY=${{ secrets.DEV_FIREBASE_API_KEY }}" >> $GITHUB_ENV
echo "FIREBASE_AUTH_DOMAIN=${{ secrets.DEV_FIREBASE_AUTH_DOMAIN }}" >> $GITHUB_ENV
echo "FIREBASE_DATABASE_URL=${{ secrets.DEV_FIREBASE_DATABASE_URL }}" >> $GITHUB_ENV
echo "FIREBASE_PROJECT_ID=${{ secrets.DEV_FIREBASE_PROJECT_ID }}" >> $GITHUB_ENV
echo "FIREBASE_STORAGE_BUCKET=${{ secrets.DEV_FIREBASE_STORAGE_BUCKET }}" >> $GITHUB_ENV
echo "FIREBASE_MESSAGING_SENDER_ID=${{ secrets.DEV_FIREBASE_MESSAGING_SENDER_ID }}" >> $GITHUB_ENV
echo "FIREBASE_APP_ID=${{ secrets.DEV_FIREBASE_APP_ID }}" >> $GITHUB_ENV
echo "FIREBASE_MEASUREMENT_ID=${{ secrets.DEV_FIREBASE_MEASUREMENT_ID }}" >> $GITHUB_ENV
echo "GOOGLE_MAPS_API_KEY=${{ secrets.DEV_GOOGLE_MAPS_API_KEY }}" >> $GITHUB_ENV
# Step 6: Generate environment file
- name: Generate environment file
run: node generate-env.js
# Step 7: Build the project (Development)
- name: Build Project
run: npm run build
# Step 8: Run tests
- name: Run tests
run: npm run test
# Step 9: Upload Build Artifact
# - name: Upload Build Artifact
# uses: actions/upload-artifact@v3
# with:
# name: www
# path: www/ # Adjust to include all files in the build directory
# Deploy to Firebase Preview
build_and_preview:
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} # Only run for PRs from the same repo
runs-on: ubuntu-latest
needs: build-and-test
steps:
# Checkout the repository
- uses: actions/checkout@v4
# Cache node modules
- name: Cache node modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
# Set up Node.js environment
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
# Install dependencies
- name: Install dependencies
run: npm ci --legacy-peer-deps
# Set environment variables
- name: Set environment variables
run: |
echo "CI=true" >> $GITHUB_ENV
echo "NODE_ENV=development" >> $GITHUB_ENV
echo "FIREBASE_API_KEY=${{ secrets.DEV_FIREBASE_API_KEY }}" >> $GITHUB_ENV
echo "FIREBASE_AUTH_DOMAIN=${{ secrets.DEV_FIREBASE_AUTH_DOMAIN }}" >> $GITHUB_ENV
echo "FIREBASE_DATABASE_URL=${{ secrets.DEV_FIREBASE_DATABASE_URL }}" >> $GITHUB_ENV
echo "FIREBASE_PROJECT_ID=${{ secrets.DEV_FIREBASE_PROJECT_ID }}" >> $GITHUB_ENV
echo "FIREBASE_STORAGE_BUCKET=${{ secrets.DEV_FIREBASE_STORAGE_BUCKET }}" >> $GITHUB_ENV
echo "FIREBASE_MESSAGING_SENDER_ID=${{ secrets.DEV_FIREBASE_MESSAGING_SENDER_ID }}" >> $GITHUB_ENV
echo "FIREBASE_APP_ID=${{ secrets.DEV_FIREBASE_APP_ID }}" >> $GITHUB_ENV
echo "FIREBASE_MEASUREMENT_ID=${{ secrets.DEV_FIREBASE_MEASUREMENT_ID }}" >> $GITHUB_ENV
echo "GOOGLE_MAPS_API_KEY=${{ secrets.DEV_GOOGLE_MAPS_API_KEY }}" >> $GITHUB_ENV
# Generate environment file
- name: Generate environment file
run: node generate-env.js
# Build the project (Development)
- name: Build project
run: npm run build
# Deploy to Firebase Preview
- name: Deploy to Firebase Preview
id: deploy # Assign an ID to reference outputs
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_ASCENDCOOPPLATFORM_DEV }}"
projectId: ascendcoopplatform-dev
# Register the preview domain for Firebase Authentication
- name: Authorize Preview Domain
run: |
PREVIEW_DOMAIN=$(echo "${{ steps.deploy.outputs.details_url }}" | sed -E 's#https?://([^/]+)/?.*#\1#')
export GOOGLE_APPLICATION_CREDENTIALS_JSON='${{ secrets.FIREBASE_SERVICE_ACCOUNT_ASCENDCOOPPLATFORM_DEV }}'
export FIREBASE_PROJECT_ID='${{ secrets.DEV_FIREBASE_PROJECT_ID }}'
export PREVIEW_DOMAIN
node .github/scripts/addAuthorizedDomain.js