organize build scripts

This commit is contained in:
Brandon Thomas committed 2024-07-29 09:46:39 -04:00
1 parent 9061a5ac7b
commit 316e530308
3 files changed
+67 -51

No files matched your search

+23 -21
View File
@@ -3,35 +3,37 @@
set -euxo pipefail
function replace_commit_ref {
# Add the GIT SHA to the build
# This must be done before everything else, or it will get cached with the build.
# (This might be making the builds less performant?)
# COMMIT_REF is defined by Netlify to be the commit SHA
# We want a short 8 character reference.
SHORT_SHA=$(echo "${COMMIT_REF}" | cut -c1-8)
find . -type f -exec sed -i "s/CURRENT_STORYTELLER_VERSION/${SHORT_SHA}/g" {} +
# The above command won't work with Mac's version of find/sed. The following is a Mac-friendly version:
# find . -type f -exec sed -i '' -e "s/CURRENT_STORYTELLER_VERSION/${SHORT_SHA}/g" {} +
}
function build_project {
yarn install
yarn test-fakeyou --verbose
# --ignore-engines: https://stackoverflow.com/a/59615348
yarn build-fakeyou --verbose --ignore-optional --ignore-engines
}
echo "Current working directory:"
pwd
# Add the GIT SHA to the build
# This must be done before everything else, or it will get cached with the build.
# (This might be making the builds less performant?)
# COMMIT_REF is defined by Netlify to be the commit SHA
# We want a short 8 character reference.
echo "Labelling build with short SHA..."
SHORT_SHA=$(echo "${COMMIT_REF}" | cut -c1-8)
find . -type f -exec sed -i "s/CURRENT_STORYTELLER_VERSION/${SHORT_SHA}/g" {} +
# The above command won't work with Mac's version of find/sed. The following is a Mac-friendly version:
# find . -type f -exec sed -i '' -e "s/CURRENT_STORYTELLER_VERSION/${SHORT_SHA}/g" {} +
replace_commit_ref
echo "Building website..."
# Move to project root
echo "Building project..."
pushd src/website
yarn install
# Run tests first
yarn test-fakeyou --verbose
# --ignore-engines: https://stackoverflow.com/a/59615348
yarn build-fakeyou --verbose --ignore-optional --ignore-engines
build_project
popd
echo "Copying built artifacts..."
mkdir fakeyou.com
mv src/website/packages/fakeyou.com/build/ fakeyou.com/build/
+22 -15
View File
@@ -3,30 +3,37 @@
set -euxo pipefail
function replace_commit_ref {
# Add the GIT SHA to the build
# This must be done before everything else, or it will get cached with the build.
# (This might be making the builds less performant?)
# COMMIT_REF is defined by Netlify to be the commit SHA
# We want a short 8 character reference.
SHORT_SHA=$(echo "${COMMIT_REF}" | cut -c1-8)
find . -type f -exec sed -i "s/CURRENT_STORYTELLER_VERSION/${SHORT_SHA}/g" {} +
# The above command won't work with Mac's version of find/sed. The following is a Mac-friendly version:
# find . -type f -exec sed -i '' -e "s/CURRENT_STORYTELLER_VERSION/${SHORT_SHA}/g" {} +
}
function build_project {
yarn install
# --ignore-engines: https://stackoverflow.com/a/59615348
yarn build-storyteller --verbose --ignore-optional --ignore-engines
}
echo "Current working directory:"
pwd
# Add the GIT SHA to the build
# This must be done before everything else, or it will get cached with the build.
# (This might be making the builds less performant?)
# COMMIT_REF is defined by Netlify to be the commit SHA
# We want a short 8 character reference.
echo "Labelling build with short SHA..."
SHORT_SHA=$(echo "${COMMIT_REF}" | cut -c1-8)
find . -type f -exec sed -i "s/CURRENT_STORYTELLER_VERSION/${SHORT_SHA}/g" {} +
# The above command won't work with Mac's version of find/sed. The following is a Mac-friendly version:
# find . -type f -exec sed -i '' -e "s/CURRENT_STORYTELLER_VERSION/${SHORT_SHA}/g" {} +
replace_commit_ref
echo "Building website..."
# Move to project root
echo "Building project..."
pushd src/website
# --ignore-engines: https://stackoverflow.com/a/59615348
yarn build-storyteller --verbose --ignore-optional --ignore-engines
build_project
popd
echo "Copying built artifacts..."
mkdir storyteller.io
mv src/websites/packages/storyteller.io/build/ storyteller.io/build/
+22 -15
View File
@@ -3,30 +3,37 @@
set -euxo pipefail
function replace_commit_ref {
# Add the GIT SHA to the build
# This must be done before everything else, or it will get cached with the build.
# (This might be making the builds less performant?)
# COMMIT_REF is defined by Netlify to be the commit SHA
# We want a short 8 character reference.
SHORT_SHA=$(echo "${COMMIT_REF}" | cut -c1-8)
find . -type f -exec sed -i "s/CURRENT_STORYTELLER_VERSION/${SHORT_SHA}/g" {} +
# The above command won't work with Mac's version of find/sed. The following is a Mac-friendly version:
# find . -type f -exec sed -i '' -e "s/CURRENT_STORYTELLER_VERSION/${SHORT_SHA}/g" {} +
}
function build_project {
yarn install
# --ignore-engines: https://stackoverflow.com/a/59615348
yarn build-trumped --verbose --ignore-optional --ignore-engines
}
echo "Current working directory:"
pwd
# Add the GIT SHA to the build
# This must be done before everything else, or it will get cached with the build.
# (This might be making the builds less performant?)
# COMMIT_REF is defined by Netlify to be the commit SHA
# We want a short 8 character reference.
echo "Labelling build with short SHA..."
SHORT_SHA=$(echo "${COMMIT_REF}" | cut -c1-8)
find . -type f -exec sed -i "s/CURRENT_STORYTELLER_VERSION/${SHORT_SHA}/g" {} +
# The above command won't work with Mac's version of find/sed. The following is a Mac-friendly version:
# find . -type f -exec sed -i '' -e "s/CURRENT_STORYTELLER_VERSION/${SHORT_SHA}/g" {} +
replace_commit_ref
echo "Building website..."
# Move to project root
echo "Building project..."
pushd src/website
# --ignore-engines: https://stackoverflow.com/a/59615348
yarn build-trumped --verbose --ignore-optional --ignore-engines
build_project
popd
echo "Copying built artifacts..."
mkdir trumped.com
mv src/websites/packages/trumped.com/build/ trumped.com/build/