update site for a new release from sources repo #34
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
# Update download package, core for upgrading, site core version and content, RSS, test.html | |
# Site content (what's new etc) in the main repo should be updated manually before running this | |
name: update site for a new release from sources repo | |
on: | |
workflow_dispatch: | |
inputs: | |
committerName: | |
description: "Username for commit" | |
required: true | |
committerEmail: | |
description: "User email for commit" | |
required: true | |
jobs: | |
build-and-update: | |
runs-on: ubuntu-latest | |
steps: | |
# todo: | |
# - try to restore generation of RSS on Ubuntu (why phantomjs fails now? different node.js version? [can test on Contabo] | |
# try to fix.. or use Puppeteer instead.. or without headless browser at all) | |
# * construct commit message based on what was really updated | |
- uses: actions/checkout@v2 | |
- name: config git | |
run: | | |
git config --global user.name ${{ github.event.inputs.committerName }} | |
git config --global user.email ${{ github.event.inputs.committerEmail }} | |
- name: get TiddlyWiki source and install dependencies | |
run: | | |
git clone https://github.com/TiddlyWiki/TiddlyWiki.git | |
cd TiddlyWiki | |
npm i | |
# looks like on each new step cwd is changed back to the "root", so we cd back | |
- name: build index.html, index.xml (RSS), move and stage resulting files | |
run: | | |
cd TiddlyWiki | |
npm run build-site | |
echo "built site parts:" >> build_summary.txt | |
ls ./build/cooked/* >> build_summary.txt | |
if [ ! -f ./build/cooked/*/index.xml ]; then | |
echo "warning: index.xml was not created" >> build_summary.txt | |
fi | |
# generating index.html may fail (on Ubuntu, unlike on Windows), so use wildcards | |
mv ./build/cooked/*/* ../ | |
cd .. | |
git add *.* | |
- name: build empty TW, copy resulting file as empty.html, upgrade/index.html, stage them | |
run: | | |
cd TiddlyWiki | |
npm run build-core | |
echo "built core:" >> build_summary.txt | |
ls ./build/cooked/* >> build_summary.txt | |
cp ./build/cooked/*/empty.html ../ | |
cp ./build/cooked/*/empty.html ../upgrade/index.html | |
cd .. | |
git add empty.html upgrade/index.html | |
- name: build tests.html, move resulting file, stage it | |
run: | | |
cd TiddlyWiki | |
npm run build-test | |
echo "built test:" >> build_summary.txt | |
ls ./build/cooked/* >> build_summary.txt | |
mv ./build/cooked/*/test.html ../tests.html | |
cd .. | |
git add tests.html | |
- name: build tiddlywiki_externaljs.html and js files, move, stage | |
run: | | |
cd TiddlyWiki | |
npm run build-external-core | |
echo "built external core:" >> build_summary.txt | |
ls ./build/cooked/* >> build_summary.txt | |
# tiddlywiki_externaljs.html jquery.js jQuery.twStylesheet.js twcore.js | |
mv ./build/cooked/*/* ../ | |
cd .. | |
git add *.* | |
- name: summarize what's built and what's updated | |
run: | | |
cat TiddlyWiki/build_summary.txt | |
echo "===" | |
git status | |
- name: commit and push result | |
run: | | |
cd TiddlyWiki | |
package=$(cat package.json) | |
version=$(node -pe 'JSON.parse(process.argv[1]).version' "$package") | |
cd .. | |
# git commit -m "update site to v$version (index.html?, index.xml?, empty.html, upgrade/index.html, test.html, tiddlywiki_externaljs.html, jquery.js, jQuery.twStylesheet.js, twcore.js)" | |
git commit -m "update site to v$version" | |
git push |