Update action.yml

This commit is contained in:
Carneiro 2024-11-24 12:03:17 -03:00
parent b88134d13b
commit 12ade96a9b
1 changed files with 25 additions and 9 deletions

View File

@ -6,6 +6,15 @@ inputs:
site-dirname:
description: "Site directory (inside /var/www/html/alice_sites) name"
default: ${{ github.event.repository.name }}
source-dir:
description: "Source directory"
default: "/var/www/src/alice_sites"
dest-dir:
description: "Destination directory"
default: "/var/www/html/alice_sites"
jekyll-args:
description: "Args to pass to jekyll build"
default: "--trace --incremental"
skip-build:
description: "Wheather or not the sites skips building"
default: "false"
@ -30,21 +39,28 @@ runs:
SITE_DIRNAME: ${{ inputs.site-dirname }}
REPO_NAME: ${{ gitea.repository }}
SKIP_BUILD: ${{ inputs.skip-build }}
SOURCE_DIR: ${{ inputs.source-dir }}
DEST_DIR: ${{ inputs.dest-dir }}
JEKYLL_ARGS: ${{ inputs.jekyll-args }}
with:
host: ${{ inputs.host }}
username: ${{ inputs.username }}
key: ${{ inputs.key }}
port: ${{ inputs.port }}
envs: SITE_DIRNAME, REPO_NAME, SKIP_BUILD
envs: SITE_DIRNAME, REPO_NAME, SKIP_BUILD, SOURCE_DIR, DEST_DIR, JEKYLL_ARGS
script: |
SITES_DIR="/var/www/src/alice_sites"
# if site is not there yet, clone it
[ -d "${SITES_DIR}/${SITE_DIRNAME}" ] ||
sudo -u www-data "git clone https://git.alice.ufsj.edu.br/$REPO_NAME"
cd $SOURCE_DIR
cd "${SITES_DIR}/${SITE_DIRNAME}"
sudo -u www-data git pull
# If site is not there yet, clone it
[ -d "${SOURCE_DIR}/${SITE_DIRNAME}" ] ||
git clone https://git.alice.ufsj.edu.br/$REPO_NAME
# Update
cd "${SOURCE_DIR}/${SITE_DIRNAME}"
git pull
# Build
[ $SKIP_BUILD != false ] && exit 0
sudo -u www-data bundle install
sudo -u www-data make deploy
bundle install
bundle exec jekyll build $JEKYLL_ARGS --destination=$DEST_DIR/$SITE_DIRNAME