Compare commits
No commits in common. "main" and "backup-v1.4" have entirely different histories.
main
...
backup-v1.
3 changed files with 51 additions and 24 deletions
|
@ -1,3 +1,3 @@
|
||||||
[![Open in Visual Studio Code](https://open.vscode.dev/badges/open-in-vscode.svg)](https://open.vscode.dev/justgoodin/pelican-build-action)
|
# Build & Deploy Pelican SSG sites to multiple providers
|
||||||
# Build Pelican SSG sites
|
Current options available
|
||||||
This builds the Pelican SSG website and make it ready for deployment
|
1. Github Pages
|
||||||
|
|
21
action.yml
21
action.yml
|
@ -11,15 +11,22 @@ runs:
|
||||||
image: 'Dockerfile'
|
image: 'Dockerfile'
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
PELICAN_CONFIG_FILE:
|
GH_PAGES_BRANCH:
|
||||||
description: 'override the default `publishconf.py` config file'
|
description: 'override the default `gh-pages` deployment branch'
|
||||||
required: false
|
required: false
|
||||||
default: publishconf.py
|
default: 'gh-pages'
|
||||||
|
GH_PAGES_CNAME:
|
||||||
|
description: 'specify the custom domain configured for the output branch'
|
||||||
|
required: false
|
||||||
|
default: none
|
||||||
|
PELICAN_CONFIG_FILE:
|
||||||
|
description: 'override the default `pelicanconf.py` config file'
|
||||||
|
required: false
|
||||||
|
default: pelicanconf.py
|
||||||
PELICAN_CONTENT_FOLDER:
|
PELICAN_CONTENT_FOLDER:
|
||||||
description: 'override the default `content` content folder'
|
description: 'override the default `content` content folder'
|
||||||
required: false
|
required: false
|
||||||
default: content
|
default: content
|
||||||
PELICAN_OUTPUT_FOLDER:
|
PELICAN_THEME_FOLDER:
|
||||||
description: 'override the default `output` output folder'
|
description: 'setup the theme folder with package.json file, is required if you need install node modules'
|
||||||
required: false
|
required: false
|
||||||
default: output
|
|
|
@ -2,22 +2,42 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
echo "CONFIG: $PELICAN_CONFIG_FILE"
|
echo "REPO: $GITHUB_REPOSITORY"
|
||||||
echo "CONTENT: $PELICAN_CONTENT_FOLDER"
|
echo "ACTOR: $GITHUB_ACTOR"
|
||||||
echo "OUTPUT: $PELICAN_OUTPUT_FOLDER"
|
|
||||||
|
|
||||||
echo 'Installing Python 🐍 Requirements '
|
remote_repo="https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
|
||||||
|
remote_branch=${GH_PAGES_BRANCH:=gh-pages}
|
||||||
|
|
||||||
|
echo 'Installing Python Requirements 🐍 '
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
|
|
||||||
|
if [ -n "$PELICAN_THEME_FOLDER" ]; then
|
||||||
echo 'Building site 👷 '
|
echo 'Installing Node Modules 🧰 '
|
||||||
pelican -D ${PELICAN_CONTENT_FOLDER:=content} -o ${PELICAN_OUTPUT_FOLDER:=output} -s ${PELICAN_CONFIG_FILE:=publishconf.py}
|
pushd $PELICAN_THEME_FOLDER
|
||||||
|
npm install
|
||||||
if [ -f addons.py ]; then
|
popd
|
||||||
echo 'Running add-ons ➕➕ '
|
|
||||||
python addons.py
|
|
||||||
else
|
|
||||||
echo 'No add-ons configured'
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo 'Build complete 🎉🎉 🕺💃 '
|
echo 'Building site 👷 '
|
||||||
|
pelican ${PELICAN_CONTENT_FOLDER:=content} -o output -s ${PELICAN_CONFIG_FILE:=publishconf.py}
|
||||||
|
|
||||||
|
echo 'Publishing to GitHub Pages 📤 '
|
||||||
|
pushd output
|
||||||
|
git init
|
||||||
|
git remote add deploy "$remote_repo"
|
||||||
|
git checkout $remote_branch || git checkout --orphan $remote_branch
|
||||||
|
git config user.name "${GITHUB_ACTOR}"
|
||||||
|
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
||||||
|
if [ "$GH_PAGES_CNAME" != "none" ]
|
||||||
|
then
|
||||||
|
echo "$GH_PAGES_CNAME" > CNAME
|
||||||
|
fi
|
||||||
|
git add .
|
||||||
|
|
||||||
|
echo -n 'Files to Commit:' && ls -l | wc -l
|
||||||
|
git commit -m "[ci skip] Automated deployment to GitHub Pages on $(date +%s%3N)"
|
||||||
|
git push deploy $remote_branch --force
|
||||||
|
rm -fr .git
|
||||||
|
popd
|
||||||
|
|
||||||
|
echo 'Done 🎉🎉 🕺💃 '
|
||||||
|
|
Loading…
Reference in a new issue