Skip to content

Commit

Permalink
Merge pull request #1857 from Kajabi/STANDARD/node-18-spike-v2
Browse files Browse the repository at this point in the history
STANDARD: Node 18
  • Loading branch information
voodooGQ authored Jan 25, 2024
2 parents 175a2d7 + 6c54787 commit 633d0cb
Show file tree
Hide file tree
Showing 18 changed files with 78 additions and 84 deletions.
3 changes: 2 additions & 1 deletion .env.dist
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
KAJABI_PRODUCTS_PATH=
KAJABI_PRODUCTS_PATH="/home/username/path/to/kajabi-products"
NODE_OPTIONS="--openssl-legacy-provider"
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Set Node Version
uses: actions/setup-node@v3
with:
node-version: 16.20.2
node-version: 18.17.1

- name: Documentation Site Deploy
env:
Expand Down
51 changes: 45 additions & 6 deletions .github/workflows/lint-test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,65 @@ jobs:
lint_test_build:
name: Lint, Test, Build
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ${{ fromJSON(vars.NODE_VERSIONS) }}
steps:
- name: Clone Sage-Lib Repo
uses: actions/checkout@v3

- name: Set Node Version
uses: actions/setup-node@v3
with:
node-version: "16"
node-version: ${{ matrix.node-version }}

- name: Install Yarn
run: npm install -g yarn
env:
NODE_VERSION: ${{ matrix.node-version }}
run: |
if [[ $NODE_VERSION == '18' ]]; then
NODE_OPTIONS=--openssl-legacy-provider npm install -g yarn
else
npm install -g yarn
fi
- name: Yarn Install
run: yarn install
env:
NODE_VERSION: ${{ matrix.node-version }}
run: |
if [[ $NODE_VERSION == '18' ]]; then
NODE_OPTIONS=--openssl-legacy-provider yarn install
else
yarn install
fi
- name: Yarn Lint
run: yarn lint
env:
NODE_VERSION: ${{ matrix.node-version }}
run: |
if [[ $NODE_VERSION == '18' ]]; then
NODE_OPTIONS=--openssl-legacy-provider yarn lint
else
yarn lint
fi
- name: Yarn Test
run: yarn test
env:
NODE_VERSION: ${{ matrix.node-version }}
run: |
if [[ $NODE_VERSION == '18' ]]; then
NODE_OPTIONS=--openssl-legacy-provider yarn test
else
yarn test
fi
- name: Yarn Build
run: yarn build
env:
NODE_VERSION: ${{ matrix.node-version }}
run: |
if [[ $NODE_VERSION == '18' ]]; then
NODE_OPTIONS=--openssl-legacy-provider yarn build
else
yarn build
fi
12 changes: 6 additions & 6 deletions .github/workflows/release-deploy-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.20.2
node-version: 18.17.1

- name: Set NPM Config
run: npm config set '//npm.pkg.github.com/:_authToken' '${{ secrets.ACCESS_TOKEN }}'
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.20.2
node-version: 18.17.1

- name: Restore Node modules
uses: actions/cache/restore@v3
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.20.2
node-version: 18.17.1

- name: Restore Node modules
uses: actions/cache/restore@v3
Expand Down Expand Up @@ -126,7 +126,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.20.2
node-version: 18.17.1

- name: Restore Node modules
uses: actions/cache/restore@v3
Expand Down Expand Up @@ -174,7 +174,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.20.2
node-version: 18.17.1

- name: Restore Node modules
uses: actions/cache/restore@v3
Expand Down Expand Up @@ -241,7 +241,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.20.2
node-version: 18.17.1

- name: Deploy Documentation Site
env:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release-deploy-v3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.20.2
node-version: 18.17.1

- name: Set NPM Config
run: npm config set '//npm.pkg.github.com/:_authToken' '${{ secrets.ACCESS_TOKEN }}'
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.20.2
node-version: 18.17.1

- name: Restore Node modules
uses: actions/cache/restore@v3
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.20.2
node-version: 18.17.1

- name: Restore Node modules
uses: actions/cache/restore@v3
Expand Down Expand Up @@ -126,7 +126,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.20.2
node-version: 18.17.1

- name: Restore Node modules
uses: actions/cache/restore@v3
Expand Down Expand Up @@ -174,7 +174,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.20.2
node-version: 18.17.1

- name: Restore Node modules
uses: actions/cache/restore@v3
Expand Down Expand Up @@ -241,7 +241,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.20.2
node-version: 18.17.1

- name: Deploy Documentation Site
env:
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.20.2
18.17.1
2 changes: 2 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nodejs 18.17.1
ruby 2.7.7
25 changes: 0 additions & 25 deletions bin/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,6 @@ function add_token() {
echo "//npm.pkg.github.com/:_authToken=${GH_TOKEN}" >> ~/.npmrc
}

# Install the CircleCI CLI if it's missing
function install_circleci_cli() {
which circleci > /dev/null || (
case "$(uname -s)" in
Darwin)
brew install circleci
;;
Linux)
set -x
tempd=$(mktemp -d)
curl https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/master/install.sh > $tempd/install.sh
chmod a+x $tempd/install.sh
sudo $tempd/install.sh
rm -rf $tempd
set +x
;;
*)
echo "OS type (${uname -s}) is not currently supported."
exit 1
;;
esac
)
}

# Check to see if we have an auth token for GitHub in the main npmrc
if grep -Fq "npm.pkg.github.com" ~/.npmrc; then
echo_custom '[SETUP] Found GitHub authorization token in ~/.npmrc'
Expand All @@ -50,5 +26,4 @@ else
add_token
fi

install_circleci_cli;
yarn setup:init
6 changes: 6 additions & 0 deletions docs/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ module.exports = function(api) {
'@babel/plugin-syntax-dynamic-import',
isTestEnv && 'babel-plugin-dynamic-import-node',
'@babel/plugin-transform-destructuring',
[
'@babel/plugin-proposal-private-property-in-object',
{
loose: true
}
],
[
'@babel/plugin-proposal-class-properties',
{
Expand Down
2 changes: 0 additions & 2 deletions docs/catalog-info.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ metadata:
- url: https://sage-lib-documentation.herokuapp.com/pages/index
title: Public Documentation Site
icon: dashboard
annotations:
circleci.com/project-slug: github/Kajabi/sage-lib
spec:
type: website
lifecycle: production
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"test": "test"
},
"engines": {
"node": "16.x",
"node": "16.x || 18.x",
"npm": "8.x",
"yarn": "1.x"
},
Expand Down
6 changes: 0 additions & 6 deletions lefthook.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
pre-push:
commands:
circleci_validate:
files: git diff --name-only main -- .circleci/config.yml
run: circleci config validate

pre-commit:
commands:
yarn_validate:
Expand Down
3 changes: 2 additions & 1 deletion packages/sage-assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"sassdoc/*"
],
"engines": {
"node": "16.x",
"node": "16.x || 18.x",
"npm": "8.x",
"yarn": "1.x"
},
Expand All @@ -38,6 +38,7 @@
"devDependencies": {
"@babel/core": "^7.11.6",
"@babel/preset-env": "^7.11.5",
"@babel/plugin-proposal-private-methods": "^7.18.6",
"babel-loader": "^8.1.0",
"css-loader": "^5.0.1",
"eslint": "^7.17.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/sage-packs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"packs"
],
"engines": {
"node": "16.x",
"node": "16.x || 18.x",
"npm": "8.x",
"yarn": "1.x"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/sage-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"url": "https://github.com/Kajabi/sage-lib/issues"
},
"engines": {
"node": "16.x",
"node": "16.x || 18.x",
"npm": "8.x",
"yarn": "1.x"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/sage-system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dist/*"
],
"engines": {
"node": "16.x",
"node": "16.x || 18.x",
"npm": "8.x",
"yarn": "1.x"
},
Expand Down
4 changes: 0 additions & 4 deletions readme/AUTOMATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ Configuration for [commitlint](https://github.com/conventional-changelog/commitl

A hook prior to commit is in place to ensure the integrity of the `yarn.lock` file. If the `yarn.lock` file is not in-sync during release then the CI job will throw an error indicating that the `yarn.lock` is out of date. A script located at `bin/yarn-check.sh` in the root of this repository is designed to verify if yarn is out of sync, and if it is we will [bootstrap](https://github.com/lerna/lerna/tree/main/commands/bootstrap#readme) the Lerna monorepository, add the updated `yarn.lock` and create a separate `chore` commit for the new lock file.

### `pre-push`

Prior to pushing a series of commits a hook is in place to verify the integrity of the `.circleci/config.yml` file. This check ensures that the config file is "valid" and will be run on CircleCI.

## Initial Setup

A series of automations have been created for initial repository setup. The `yarn setup` script in the root of this repository follows this flow:
Expand Down
24 changes: 3 additions & 21 deletions readme/CICD.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Continuous Integration, Deployment, Versioning, and Releases

Continuous Integration is being handled by CircleCI with deployments going to Heroku. Lerna is integrated into the Pipeline to allow for automatic Versioning, Changelogs, and Releases.
Continuous Integration is being handled by GitHub Actions with deployments going to Heroku. Lerna is integrated into the Pipeline to allow for automatic Versioning, Changelogs, and Releases.

## Jobs

Expand All @@ -22,7 +22,7 @@ The `bin/bump-gem.sh` script is executed as part of the versioning processes to

Once all versioning is handled Lerna will [publish](https://github.com/lerna/lerna/tree/main/commands/publish#readme) tags and releases to the main repository.

CircleCI will then initiate a deployment of the primary "docs" site, the storybook site as part of the `@kajabi/sage-react` package, and the sassdocs site as part of the `@kajabi/sage-assets` package. Read the Deployment section of this document for more information.
GitHub Actions will then initiate a deployment of the primary "docs" site, the storybook site as part of the `@kajabi/sage-react` package, and the sassdocs site as part of the `@kajabi/sage-assets` package. Read the Deployment section of this document for more information.

## Deployment

Expand All @@ -34,15 +34,9 @@ Deployed to: https://sage-lib-documentation.herokuapp.com/

The `docs:deploy` script at the root of the monorepo is designed to push a subtree of the `docs/` folder to the Heroku master.

#### CircleCI Env Requirements

- **$GH_TOKEN**: A GitHub Personal Access Token with permissions to publish to the repository as well as packages.
- **$HEROKU_API_KEY**: An API key with access to deploy to the environment
- **$HEROKU_DOCS_APP_NAME**: The git address name for the Heroku app (e.g. "sage-lib-documentation")

#### Heroku Env Requirements

- **NPMRC**: Utilize the $GH_TOKEN environment variable listed in your CircleCI env in place of `<your_token>`:
> Note: Must be a valid GitHub PAT
```text
//npm.pkg.github.com/:_authToken=<your_token>
Expand All @@ -61,12 +55,6 @@ Deployed to: https://sage-lib-storybook.herokuapp.com/

The `storybook:deploy` script at the root of the monorepo is designed to push a subtree of the `packages/sage-react` folder to the Heroku master.

#### CircleCI Env Requirements

- **$GH_TOKEN**: A GitHub Personal Access Token with permissions to publish to the repository as well as packages.
- **$HEROKU_API_KEY**: An API key with access to deploy to the environment
- **$HEROKU_STORYBOOK_APP_NAME:** The git address name for the Heroku app (e.g. "sage-lib-storybook")

#### Heroku Buildpack Requirements

- heroku/nodejs
Expand All @@ -77,12 +65,6 @@ Deployed to: https://sage-lib-sassdocs.herokuapp.com/

The `sassdoc:deploy` script at the root of the monorepo is designed to push a subtree of the `packages/sage-assets` folder to the Heroku master.

#### CircleCI Env Requirements

- **$GH_TOKEN**: A GitHub Personal Access Token with permissions to publish to the repository as well as packages.
- **$HEROKU_API_KEY**: An API key with access to deploy to the environment
- **$HEROKU_SASSDOCS_APP_NAME**: The git address name for the Heroku app (e.g. "sage-lib-sassdocs")

#### Heroku Buildpack Requirements

- heroku/nodejs

0 comments on commit 633d0cb

Please sign in to comment.