-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #247 from UCDavisLibrary/sp-js-build
Dist build and zip script
- Loading branch information
Showing
14 changed files
with
38,088 additions
and
700 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
ARG NODE_VERSION=18 | ||
FROM node:${NODE_VERSION} | ||
|
||
ARG THEME_TAG | ||
|
||
WORKDIR /theme | ||
|
||
# Get fresh copy of theme | ||
RUN git clone https://github.com/UCDavisLibrary/ucdlib-theme-wp.git | ||
WORKDIR /theme/ucdlib-theme-wp | ||
RUN git checkout ${THEME_TAG} | ||
RUN git pull | ||
|
||
# Install dependencies | ||
RUN cd src/public && npm install | ||
RUN cd src/editor && npm install | ||
|
||
# Build assets | ||
RUN cd src/public && npm run dist | ||
RUN cd src/editor && npm run dist | ||
|
||
# remove node_modules | ||
RUN cd src/public && rm -rf node_modules | ||
RUN cd src/editor && rm -rf node_modules | ||
|
||
WORKDIR /theme | ||
|
||
COPY container-scripts scripts | ||
|
||
ENTRYPOINT [ "bash", "-c" ] | ||
CMD ["echo 'Use command arg to specify a script to run.'"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#! /bin/bash | ||
|
||
### | ||
# Process for building theme image | ||
### | ||
|
||
set -e | ||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
cd $SCRIPT_DIR/.. | ||
|
||
THEME_TAG=${1:-main} | ||
echo "Building theme image with tag: $THEME_TAG" | ||
docker build \ | ||
-t localhost/local-dev/ucdlib-theme-wp:$THEME_TAG \ | ||
--build-arg BUILDKIT_INLINE_CACHE=1 \ | ||
--build-arg THEME_TAG=${THEME_TAG} \ | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#! /bin/bash | ||
|
||
### | ||
# Build and zip up theme and save to io directory | ||
### | ||
|
||
set -e | ||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
cd $SCRIPT_DIR/.. | ||
|
||
THEME_TAG=${1:-main} | ||
./cmds/build.sh $THEME_TAG | ||
IMAGE=localhost/local-dev/ucdlib-theme-wp:$THEME_TAG | ||
|
||
# check if io directory exists, create if not | ||
if [ ! -d "./io" ]; then | ||
mkdir ./io | ||
fi | ||
|
||
echo "Zipping up theme image with tag: $THEME_TAG" | ||
docker run --rm -v $(pwd)/io:/theme/io $IMAGE ./scripts/zip.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#! /bin/bash | ||
set -e | ||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
cd $SCRIPT_DIR/.. | ||
|
||
THEME_TAG=$(cd ucdlib-theme-wp && git rev-parse --abbrev-ref HEAD) | ||
ZIP_FILE=ucdlib-theme-wp-$THEME_TAG.zip | ||
|
||
echo "Zipping up theme image with tag: $THEME_TAG" | ||
tar -czvf io/$ZIP_FILE ucdlib-theme-wp | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Dist Build | ||
|
||
For every release of a theme, a version with the built dist js/css should be zipped up and uploaded to the releases page. | ||
|
||
run `./cmds/zip.sh <tag>`, which will place a zip file in the `io` directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.