Skip to content

Commit

Permalink
v8.0.0 (#371)
Browse files Browse the repository at this point in the history
## Breaking Changes
* Drop support for node pre v12
* Switch to node 14 in CI workflows
* Update to Node 14 Runtime in cloud functions

## Features/Updates
* react-hook-form v6 to v7
* cypress v6 to v7
* Adding preview channel to verify workflow (with associated delete preview channel workflow which removes preview channel on merge)
* Update `husky` v4 to v6
* Update `yeoman-generator` from v4 to v5
* Update `yeoman-test` from v2 to v6
  • Loading branch information
prescottprue committed May 2, 2021
1 parent 44afb7c commit 97731f3
Show file tree
Hide file tree
Showing 124 changed files with 4,236 additions and 3,182 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
plugins: ['babel', 'react', 'prettier'],
settings: {
react: {
version: '16.10'
version: '17.0.0'
}
},
rules: {
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Use Node 12
- name: Use Node 14
uses: actions/[email protected]
with:
node-version: 12
node-version: 14
registry-url: https://registry.npmjs.org/

- name: Get yarn cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 12.x, 14.x]
node-version: [12.x, 14.x]
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
Expand Down
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lint-staged

This file was deleted.

2 changes: 1 addition & 1 deletion examples/react-firebase/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
plugins: ['import', 'react', 'react-hooks', 'prettier'],
settings: {
react: {
version: '16.12'
version: '17.0'
},
'import/resolver': {
node: {
Expand Down
2 changes: 1 addition & 1 deletion examples/react-firebase/.firebaserc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"projects": {
"default": "redux-firebasev3",
"master": "redux-firebasev3",
"main": "redux-firebasev3",
"prod": "redux-firebasev3"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Delete Preview Channel

on:
pull_request:
branches:
- main
types: [closed]

jobs:
check:
name: remove channel
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
matrix:
os: [ubuntu-20.04]
node-version: [14.x]
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- name: Checkout code
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }} on ${{ matrix.os }}
uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}

- name: Get Yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache Yarn dependencies
uses: actions/[email protected]
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ matrix.app }}-preview-remove-${{ hashFiles('yarn.lock') }}

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Remove Preview Channel
env:
GCLOUD_PROJECT: redux-firebasev3
PR_NUMBER: ${{ github.event.number }}
APP_NAME: ${{ matrix.app }}
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
run: |
./bin/remove-preview-channel.js --pullRequest=$PR_NUMBER
71 changes: 19 additions & 52 deletions examples/react-firebase/.github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup Node
uses: actions/[email protected]
with:
node-version: 12
node-version: 14

- name: Get Library Versions For Binary Caching
id: cache-settings
Expand All @@ -43,70 +43,37 @@ jobs:
yarn install --frozen-lockfile
yarn --cwd functions install --frozen-lockfile
- name: Set App Environment Settings
env:
MASTER_SERVICE_ACCOUNT: ${{ secrets.MASTER_SERVICE_ACCOUNT }}
PROD_SERVICE_ACCOUNT: ${{ secrets.PROD_SERVICE_ACCOUNT }}
GITHUB_HEAD_REF: ${{ github.head_ref }}
GITHUB_REF: ${{ github.ref }}
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
- name: Set environment
run: |
set -o pipefail
# Throw a clear error if FIREBASE_TOKEN secret is not set
if [ -z "$FIREBASE_TOKEN" ];
then
errMsg="\"FIREBASE_TOKEN\" github secret is required to load project configuration. Visit https://github.com/${{ github.repository }}/settings/secrets to set."
echo "::error ::$errMsg"
exit 1
fi
# Get branch name from github ref (i.e. refs/heads/master -> master)
gitBranch=${GITHUB_REF##*/}
# Find the config associated to the firebase project in .firebaserc (falling back to default)
gcloudProject=$(cat .firebaserc | jq -r --arg alias "$gitBranch" '.projects[$alias] // .projects.default')
appName=react-firebase
echo "Setting environment for branch: $gitBranch, project: $gcloudProject, and app: $appName..."
# Set variables to environment to be used in later steps
echo "GCLOUD_PROJECT=$gcloudProject" >> $GITHUB_ENV
echo "NODE_CONFIG_ENV=$branch" >> $GITHUB_ENV
echo "ENV=$branch" >> $GITHUB_ENV
# Get value of Service Account associated with branch (i.e. STAGE_SERVICE_ACCOUNT)
branchPrefix=$(echo $gitBranch | tr a-z A-Z | tr - _)
branchSaKey="${branchPrefix}_SERVICE_ACCOUNT"
branchSa=$(eval echo \$${branchSaKey})
if [[ ! -z "${branchSa}" ]]; then
echo Using service account with key \"$branchSaKey\"
serviceAccount=$branchSa
else
echo Falling back to service account with key "DEVELOP_SERVICE_ACCOUNT"
serviceAccount=$DEVELOP_SERVICE_ACCOUNT
- name: Generate Firebase SDK config for ${{ env.GCLOUD_PROJECT }}
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
run: |
set -o pipefail
# Throw a clear error if FIREBASE_TOKEN secret is not set
if [ -z "$FIREBASE_TOKEN" ];
then
missingTokenErrMsg="\"FIREBASE_TOKEN\" github secret is required to load project configuration. Visit https://github.com/${{ github.repository }}/settings/secrets to set."
echo "::error ::$missingTokenErrMsg"
exit 1
fi
echo "Service Account selected for projectId $(echo $serviceAccount | jq .project_id)"
# Generate Service Account file required to prevent credential error during functions unit tests (jq used to format)
echo "Generating Service Account File..."
echo "$(echo $serviceAccount | jq .)" > $HOME/serviceAccount.json
echo "GOOGLE_APPLICATION_CREDENTIALS=$HOME/serviceAccount.json" >> $GITHUB_ENV
# Use Firebase SDK API to get the app's configuration and export to REACT_APP prefixed environment variables
# NOTE: databaseURL is intentionally removed since it is set above
firebaseConfig=$(npx firebase --project $gcloudProject apps:sdkconfig WEB \
$(npx firebase --project $gcloudProject apps:list WEB | grep $appName | awk '{ print $4}') | \
tr '\n' ' ' | \
sed 's/.*initializeApp(//g' | \
sed 's/);//g' | \
jq -r 'to_entries[] | [.key, (.value | tojson)] | join("::")' | \
sed 's/::"/=/g; s/^/echo \"REACT_APP_FB_/g' \
)
# Loop through each line of config and evaluate to export env vars
while IFS= read -r line; do
echo Evaluating: $line
eval $line >> $GITHUB_ENV
done <<< "$firebaseConfig"
bin/generate-firebase-sdk-config.js --file ./config/default.json
- name: Verify App
run: |
Expand Down Expand Up @@ -140,7 +107,7 @@ jobs:
- name: Check if version has been updated
if: github.ref == 'refs/heads/prod'
id: check
uses: EndBug/version-check@v1
uses: EndBug/version-check@v2.0.1

- name: Create Github Release
if: github.ref == 'refs/heads/prod' && steps.check.outputs.changed == 'true'
Expand Down

0 comments on commit 97731f3

Please sign in to comment.