Skip to content
Raydo Matthee edited this page Jun 7, 2024 · 1 revision

Table of Contents

MADJ101 Mobile App Documentation

Welcome to the MADJ101 Mobile App documentation. This project aims to develop a mobile app using GitHub and Firebase to run courses listed in the repository. The following sections provide a comprehensive guide on the setup, usage, and deployment processes.

Repository Overview

Repository: skunkworksza/MADJ101 Owner: MADJ101 Public: Yes

Repository Structure

 

. ├── .github │ ├── dependabot.yml │ └── workflows │ ├── deploy-preview.yml │ └── deploy-prod.yml ├── actions-runner ├── public │ ├── index.html │ ├── main.js │ └── style.css ├── .firebaserc ├── .gitignore ├── .prettierignore ├── .prettierrc.yaml ├── LICENSE ├── README.md ├── action.yml ├── babel.config.ts ├── firebase.json ├── firestore.indexes.json ├── firestore.rules ├── package.json └── tsconfig.json

Setup

Firebase Hosting

To set up Firebase Hosting, follow these steps:

  1. Initialize Firebase Hosting (if not already set up):
 

firebase init hosting

  1. Set up GitHub Action for Firebase Hosting:
 

firebase init hosting:github

For more details, refer to the Firebase Hosting documentation.

GitHub Actions

This project uses GitHub Actions to automate deployments. Two workflows are set up:

  1. Deploy to Preview Channel for Every PR:
   * Workflow file: .github/workflows/deploy-preview.yml
   * Deploys to a new preview channel for each pull request.
   * Adds a comment with the preview URL on the PR.
  1. Deploy to Live Channel on Merge:
   * Workflow file: .github/workflows/deploy-prod.yml
   * Deploys to the live channel on every push to the '''main''' branch.

Workflow Configuration

Deploy to Preview Channel

 

name: Deploy to Preview Channel

on:

  pull_request:
    # Optionally configure to run only for specific files. For example:
    # paths:
    # - "website/**"

jobs:

  build_and_preview:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          repoToken: "${{ secrets.GITHUB_TOKEN }}"
          firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}"
          expires: 30d
          projectId: your-Firebase-project-ID

Deploy to Live Channel

 

name: Deploy to Live Channel

on:

  push:
    branches:
      - main
    # Optionally configure to run only for specific files. For example:
    # paths:
    # - "website/**"

jobs:

  deploy_live_website:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}"
          projectId: your-Firebase-project-ID
          channelId: live

Options

Firebase Service Account

  • firebaseServiceAccount: Service account JSON key. Create using firebase init hosting:github or manually. Store this as an encrypted secret in your repository settings.

Repository Token

  • repoToken: GitHub token for commenting on PRs. Set this to ${{secrets.GITHUB_TOKEN}}. GitHub sets this automatically.

Expiry and Project ID

  • expires: Duration the preview channel remains active. Default is 7 days.
  • projectId: Firebase project ID.

Channel ID and Target

  • channelId: ID of the channel to deploy to. Default is a new preview channel per branch or PR.
  • target: Target name of the Hosting site to deploy to.

Entry Point and Firebase Tools Version

  • entryPoint: Directory containing firebase.json. Default is the repository root.
  • firebaseToolsVersion: Version of firebase-tools to use. Default is the latest.

Disable Comment

  • disableComment: Disable PR commenting with the preview URL.

Outputs

  • urls: Deployed URLs.
  • expire_time: Expiry time of the deployed preview URLs.
  • expire_time_formatted: Expiry time in UTC format.
  • details_url: Single URL that was deployed.

Status

Status: Experimental

This repository is maintained by Googlers but is not a supported Firebase product. Issues are answered by maintainers and community members on GitHub on a best-effort basis.

For further assistance and detailed setup guides, refer to the Firebase Hosting documentation.

---

By following the above steps, you can efficiently set up and manage the deployment of your MADJ101 mobile app using GitHub and Firebase. If you have any questions or need further clarification, feel free to reach out through the repository's issues section.