Skip to content

Commit

Permalink
Updating workflow and script
Browse files Browse the repository at this point in the history
  • Loading branch information
jdslaugh committed Mar 27, 2024
1 parent a4e6722 commit e28f2c6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ jobs:
node-version: "18.x"
check-latest: true
- name: Enforce consistent Yarn version
run: make yarn-ensure
run: ../../tools/install-yarn.sh bin
working-directory: ./docs/_website
- name: node_modules cache
id: node-modules-cache
uses: actions/cache@v4
Expand All @@ -30,8 +31,8 @@ jobs:
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
if: steps.node-modules-cache.outputs.cache-hit != 'true'
run: yarn install --immutable
run: ./bin/yarn.sh install --immutable
working-directory: ./docs/_website
- name: lint
run: yarn run lint
run: ./bin/yarn.sh run lint
working-directory: ./docs/_website
1 change: 1 addition & 0 deletions docs/_website/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
.docusaurus
.cache-loader
/generated
/bin

# Misc
.DS_Store
Expand Down
2 changes: 2 additions & 0 deletions docs/_website/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.1.1.js
21 changes: 13 additions & 8 deletions tools/install-yarn.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
#!/bin/bash

YARN_VERSION="4.1.1"
ROOT_DEST_DIR="$PWD/frontend"
DEST_DIR="$ROOT_DEST_DIR/.yarn/releases"
ROOT_DIR="$PWD"

if [[ ! -d "${ROOT_DIR}/frontend" ]]; then
echo "Could not find frontend directory. Ensure you're running this script from the root of your project, else it will install in the current directory."
ROOT_DEST_DIR="${ROOT_DIR}"
else
ROOT_DEST_DIR="${ROOT_DIR}/frontend"
fi

echo "Installing yarn v${YARN_VERSION} to ${ROOT_DEST_DIR} ..."

DEST_DIR="${ROOT_DEST_DIR}/.yarn/releases"
DEST_FILE="${DEST_DIR}/yarn-${YARN_VERSION}.js"
YARN_VERSION_FILE=".yarn/releases/yarn-${YARN_VERSION}.js"
WRAPPER_DEST_DIR="${PWD}/build/bin/"
WRAPPER_DEST_DIR="${ROOT_DIR}/${1:-"build/bin"}"
WRAPPER_DEST_FILE="${WRAPPER_DEST_DIR}/yarn.sh"

if [[ ! -d "${ROOT_DEST_DIR}" ]]; then
echo "Could not find frontend directory. Ensure you're running this script from the root of your project."
exit 1
fi

if [[ ! -f "${DEST_FILE}" ]]; then
echo "Downloading yarn v${YARN_VERSION} to build environment..."
mkdir -p "${DEST_DIR}"
Expand Down

0 comments on commit e28f2c6

Please sign in to comment.