Merge pull request #334 from ASCENDynamics-NFP/codex/remove-hardcoded… #168
This file contains hidden or 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
| # 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: Build and Deploy to Firebase on Merge (Development) | |
| on: | |
| push: | |
| branches: | |
| - main # Trigger workflow on push events to the main branch | |
| jobs: | |
| build_and_deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Checkout the repository | |
| - uses: actions/checkout@v4 | |
| # 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 | |
| npm ci --prefix functions | |
| # 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 | |
| # Generate environment file | |
| - name: Generate Environment File | |
| run: node generate-env.js | |
| # Build the project (Development) | |
| - name: Build Project | |
| run: npm run build:dev | |
| # Build Firebase Functions | |
| - name: Build Firebase Functions | |
| run: npm run build --prefix functions | |
| # Install Firebase CLI | |
| - name: Install Firebase CLI | |
| run: npm install -g firebase-tools | |
| # Authenticate to Google Cloud | |
| - name: Authenticate to Google Cloud | |
| uses: google-github-actions/auth@v1 | |
| with: | |
| credentials_json: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_ASCENDCOOPPLATFORM_DEV }}' | |
| # Deploy to Firebase | |
| - name: Deploy to Firebase | |
| run: firebase deploy --project ${{ secrets.DEV_FIREBASE_PROJECT_ID }} |