Skip to content

Commit

Permalink
🗜️ squash for major release
Browse files Browse the repository at this point in the history
  • Loading branch information
actuallymentor committed Apr 3, 2024
0 parents commit 61b6d76
Show file tree
Hide file tree
Showing 64 changed files with 17,476 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"presets": [
"@babel/preset-react"
]
}
12 changes: 12 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const { eslint_config } = require('@poap/skunk-linter')

// Export the default eslint config
module.exports = {
...eslint_config,
plugins: [ 'unused-imports' ],
rules: {
...eslint_config.rules,
"react/no-unescaped-entities": 0,
"unused-imports/no-unused-imports": "warn",
}
}
6 changes: 6 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"projects": {
"default": "unidentifiedanalytics",
"production": "unidentifiedanalytics"
}
}
205 changes: 205 additions & 0 deletions .github/workflows/deploy-changes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
name: Deploy on changes

on:
push:
branches:
- main

jobs:
## ###############
## 1️⃣ Deploy firebase meta changes
## ###############
deploy-firebase-settings:
name: Deploy changes to meta
runs-on: ubuntu-latest
steps:
# Clones repo to the commit that triggered the event
- name: Cloning repository
uses: actions/checkout@v3
- name: Get changed files in meta file changes
id: changed-firebase-files
uses: tj-actions/changed-files@v35
with:
files: fire{base,store}*
- name: List all changed files
run: |
echo "Any changed: ${{ steps.changed-firebase-files.outputs.any_changed }}, base ref: ${{ github.ref }}"
for file in ${{ steps.changed-firebase-files.outputs.all_changed_files }}; do
echo "change: $file"
done
# Set up node and install frontend dependencies
- name: Set up Node.js (.nvmrc)
uses: actions/setup-node@v3
if: steps.changed-firebase-files.outputs.any_changed == 'true'
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Install dependencies
if: steps.changed-firebase-files.outputs.any_changed == 'true'
run: npm ci

#########
# Deploy

- name: Set up PROD firebase
uses: w9jds/setup-firebase@main
if: |
github.ref == 'refs/heads/main' &&
steps.changed-firebase-files.outputs.any_changed == 'true'
with:
project_id: production
gcp_sa_key: ${{ secrets.GCP_SA_KEY }}
- name: Deploy metadata
if: |
steps.changed-firebase-files.outputs.any_changed == 'true'
run: firebase deploy --only=firestore


## ###############
## 2️⃣ Deploy functions
## ###############
deploy-functions:
name: Deploy changes to functions
needs: deploy-firebase-settings
runs-on: ubuntu-latest
steps:
# Clones repo to the commit that triggered the event
- name: Cloning repository
uses: actions/checkout@v3
- name: Get changed files in functions folder
id: changed-functions-files
uses: tj-actions/changed-files@v35
with:
files: functions/**
- name: List all changed files
run: |
echo "Any changed: ${{ steps.changed-functions-files.outputs.any_changed }}, base ref: ${{ github.ref }}"
for file in ${{ steps.changed-functions-files.outputs.all_changed_files }}; do
echo "change: $file"
done
# Set up node and install frontend dependencies
- name: Set up Node.js (.nvmrc)
uses: actions/setup-node@v3
if: steps.changed-functions-files.outputs.any_changed == 'true'
with:
node-version-file: "functions/.nvmrc"
cache-dependency-path: "functions/package-lock.json"
cache: "npm"
- name: Install functions dependencies
if: steps.changed-functions-files.outputs.any_changed == 'true'
run: npm ci
working-directory: functions

#####################
# Set up environment
- name: Create PROD environment files
if: |
github.ref == 'refs/heads/main' &&
steps.changed-functions-files.outputs.any_changed == 'true'
working-directory: functions
run: |
echo -e "${{ secrets.FUNCTIONS_DOTENV_PRODUCTION }}" > .env
#########
# Deploy
#########
- name: Set up PROD firebase
uses: w9jds/setup-firebase@main
if: |
github.ref == 'refs/heads/main' &&
steps.changed-functions-files.outputs.any_changed == 'true'
with:
project_id: production
gcp_sa_key: ${{ secrets.GCP_SA_KEY }}
- name: Deploy functions
if: |
steps.changed-functions-files.outputs.any_changed == 'true'
run: firebase deploy --only functions

## ###############
## 3️⃣ Deploy frontend changes
## ###############
deploy-frontend:
name: Deploy frontend changes
runs-on: ubuntu-latest
needs: [deploy-functions, deploy-firebase-settings]

steps:
# Clones repo to the commit that triggered the event
- name: Cloning repository
uses: actions/checkout@v3
- name: Get changed files
id: changed-frontend-files
uses: tj-actions/changed-files@v35
with:
files_ignore: functions/**;fire{base,store}*;.*/**
files_ignore_separator: ";"
- name: List all changed files
run: |
echo "Any changed: ${{ steps.changed-frontend-files.outputs.any_changed }}, base ref: ${{ github.base_ref }}"
for file in ${{ steps.changed-frontend-files.outputs.all_changed_files }}; do
echo "change: $file"
done
# Set up node and install frontend dependencies
- name: Set up Node.js (.nvmrc)
uses: actions/setup-node@v3
if: steps.changed-frontend-files.outputs.any_changed == 'true'
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Install dependencies
if: steps.changed-frontend-files.outputs.any_changed == 'true'
run: npm ci

# Set up environment
- name: Create PROD environment files
if: |
github.ref == 'refs/heads/main' &&
steps.changed-frontend-files.outputs.any_changed == 'true'
run: |
echo -e "${{ secrets.DOTENV_PRODUCTION }}" > .env
# Check linting
# - name: Check for linting errors
# if: steps.changed-frontend-files.outputs.any_changed == 'true'
# run: npm run lint

# Check CI
# - name: Run cypress tests
# if: steps.changed-frontend-files.outputs.any_changed == 'true'
# run: npm run test:ci

# Prep env for deployment
- name: Remove debug token and dev settings from build
if: steps.changed-frontend-files.outputs.any_changed == 'true'
run: |
sed -i 's/^REACT_APP_APPCHECK_DEBUG_TOKEN=.*$//g' .env
sed -i 's/^VITE_APPCHECK_DEBUG_TOKEN=.*$//g' .env
sed -i 's/^VITE_useEmulator=.*$//g' .env
# Build frontend files
- name: Build website files
if: steps.changed-frontend-files.outputs.any_changed == 'true'
env:
NODE_ENV: production
CI: false
run: npm run build

# Deploy frontend
- name: Set up PROD firebase
uses: w9jds/setup-firebase@main
if: |
github.ref == 'refs/heads/main' &&
steps.changed-frontend-files.outputs.any_changed == 'true'
with:
project_id: production
gcp_sa_key: ${{ secrets.GCP_SA_KEY }}

# Deploy frontend
- name: Deploy frontend
if: |
steps.changed-frontend-files.outputs.any_changed == 'true'
run: firebase deploy --only hosting
107 changes: 107 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

.*
build
1 change: 1 addition & 0 deletions .husky/_/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
36 changes: 36 additions & 0 deletions .husky/_/husky.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env sh
if [ -z "$husky_skip_init" ]; then
debug () {
if [ "$HUSKY_DEBUG" = "1" ]; then
echo "husky (debug) - $1"
fi
}

readonly hook_name="$(basename -- "$0")"
debug "starting $hook_name..."

if [ "$HUSKY" = "0" ]; then
debug "HUSKY env variable is set to 0, skipping hook"
exit 0
fi

if [ -f ~/.huskyrc ]; then
debug "sourcing ~/.huskyrc"
. ~/.huskyrc
fi

readonly husky_skip_init=1
export husky_skip_init
sh -e "$0" "$@"
exitCode="$?"

if [ $exitCode != 0 ]; then
echo "husky - $hook_name hook exited with code $exitCode (error)"
fi

if [ $exitCode = 127 ]; then
echo "husky - command not found in PATH=$PATH"
fi

exit $exitCode
fi
Loading

0 comments on commit 61b6d76

Please sign in to comment.