Skip to content

Commit aec43de

Browse files
committed
DRY-refactor book and article packaging steps
1 parent 22789a2 commit aec43de

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

.github/workflows/gh-release.yml

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -49,27 +49,19 @@ jobs:
4949
- name: build article
5050
run: cd themes/article && npm run prod:build
5151

52-
- name: package book
52+
- name: package themes
5353
run: |
54-
rm -rf dist-book && mkdir dist-book
55-
cp -r themes/book/public dist-book/public
56-
cp -r themes/book/build dist-book/build
57-
cp -r themes/book/template.yml dist-book/template.yml
58-
cp template/server.js dist-book/server.js
59-
VERSION=$(node -p "require('./packages/site/package.json').version") && sed -e "s/VERSION/$VERSION/g" -e "s/THEME/book/g" template/package.json > dist-book/package.json
60-
cd dist-book && npm install
61-
62-
- name: package article
63-
run: |
64-
rm -rf dist-article && mkdir dist-article
65-
cp -r themes/article/public dist-article/public
66-
cp -r themes/article/build dist-article/build
67-
cp -r themes/article/template.yml dist-article/template.yml
68-
cp template/server.js dist-article/server.js
69-
VERSION=$(node -p "require('./packages/site/package.json').version") && sed -e "s/VERSION/$VERSION/g" -e "s/THEME/article/g" template/package.json > dist-article/package.json
70-
cd dist-article && npm install
71-
72-
# xxx publishing to npm kept out of this workflow for now
54+
for THEME in book article; do
55+
DIST="dist-$THEME"
56+
rm -rf "$DIST" && mkdir "$DIST"
57+
cp -r "themes/$THEME/public" "$DIST/public"
58+
cp -r "themes/$THEME/build" "$DIST/build"
59+
cp -r "themes/$THEME/template.yml" "$DIST/template.yml"
60+
cp template/server.js "$DIST/server.js"
61+
VERSION=$(node -p "require('./packages/site/package.json').version")
62+
sed -e "s/VERSION/$VERSION/g" -e "s/THEME/$THEME/g" template/package.json > "$DIST/package.json"
63+
(cd "$DIST" && npm install)
64+
done
7365
7466
# Create zips
7567
- name: zip artifacts

0 commit comments

Comments
 (0)