2024-11-24 08:20:44 -03:00
|
|
|
name: "Alice Sites pull"
|
|
|
|
description: "Updates and builds alice sites"
|
|
|
|
author: "Carneiro"
|
|
|
|
|
|
|
|
inputs:
|
|
|
|
site-dirname:
|
|
|
|
description: "Site directory (inside /var/www/html/alice_sites) name"
|
|
|
|
default: ${{ github.event.repository.name }}
|
|
|
|
skip-build:
|
|
|
|
description: "Wheather or not the sites skips building"
|
|
|
|
default: "false"
|
|
|
|
host:
|
|
|
|
description: "SSH host address."
|
|
|
|
default: "${{ secrets.SSH_HOST }}"
|
|
|
|
port:
|
|
|
|
description: "SSH port number."
|
|
|
|
default: ${{ secrets.SSH_PORT }}
|
|
|
|
username:
|
|
|
|
description: "SSH username."
|
|
|
|
default: "${{ secrets.SSH_USERNAME }}"
|
|
|
|
key:
|
|
|
|
description: "SSH private key"
|
|
|
|
default: ${{ secrets.SSH_PRIV_KEY }}
|
|
|
|
|
|
|
|
runs:
|
|
|
|
using: 'composite'
|
|
|
|
steps:
|
|
|
|
- uses: appleboy/ssh-action@v1.2.0
|
|
|
|
env:
|
|
|
|
SITE_DIRNAME: ${{ inputs.site-dirname }}
|
|
|
|
REPO_NAME: ${{ gitea.repository }}
|
|
|
|
SKIP_BUILD: ${{ inputs.skip-build }}
|
|
|
|
with:
|
|
|
|
host: ${{ inputs.host }}
|
|
|
|
username: ${{ inputs.username }}
|
|
|
|
key: ${{ inputs.key }}
|
|
|
|
port: ${{ inputs.port }}
|
|
|
|
envs: SITE_DIRNAME, REPO_NAME, SKIP_BUILD
|
|
|
|
script: |
|
|
|
|
SITES_DIR="/var/www/src/alice_sites"
|
|
|
|
|
|
|
|
# if site is not there yet, clone it
|
|
|
|
[ -d "${SITES_DIR}/${SITE_DIRNAME}" ] ||
|
2024-11-24 08:39:48 -03:00
|
|
|
sudo -u www-data "git clone https://git.alice.ufsj.edu.br/$REPO_NAME"
|
2024-11-24 08:20:44 -03:00
|
|
|
|
|
|
|
cd "${SITES_DIR}/${SITE_DIRNAME}"
|
2024-11-24 08:39:48 -03:00
|
|
|
sudo -u www-data git pull
|
2024-11-24 08:20:44 -03:00
|
|
|
[ $SKIP_BUILD != false ] && exit 0
|
2024-11-24 08:39:48 -03:00
|
|
|
sudo -u www-data bundle install
|
|
|
|
sudo -u www-data make deploy
|