From d5c10c7fc31dd6a5658f6f05f93ebbfd6187503c Mon Sep 17 00:00:00 2001 From: JotaChina Date: Thu, 19 Feb 2026 17:37:09 -0300 Subject: [PATCH] Adicionar action.yml --- action.yml | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 action.yml diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..875519e --- /dev/null +++ b/action.yml @@ -0,0 +1,77 @@ +name: "Alice Sites pull (MMPSearch)" +description: "Pulls and builds jekyll sites" +author: "JotaChina" + +inputs: + src_dir: + description: "Source directory" + default: "/var/www/src/alice_sites" + dirname: + description: "Site directory (inside src_dir) name" + default: ${{ github.event.repository.name }} + output_dirname: + description: "Site destination directory name" + default: ${{ github.event.repository.name }} + 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" + 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 }} + command_timeout: + description: "Timeout para a execução do script SSH" + default: "120m" # 120 minutos (2 horas) + +runs: + using: 'composite' + steps: + - uses: appleboy/ssh-action@v1.2.0 + env: + ORIG_DIRNAME: ${{ github.event.repository.name }} + SITE_DIRNAME: ${{ inputs.dirname }} + OUTPUT_DIRNAME: ${{ inputs.output_dirname }} + REPO_NAME: ${{ gitea.repository }} + SKIP_BUILD: ${{ inputs.skip_build }} + SOURCE_DIR: ${{ inputs.src_dir }} + DEST_DIR: ${{ inputs.dest_dir }} + JEKYLL_ARGS: ${{ inputs.jekyll_args }} + with: + host: ${{ inputs.host }} + username: ${{ inputs.username }} + key: ${{ inputs.key }} + port: ${{ inputs.port }} + command_timeout: ${{ inputs.command_timeout }} + envs: SITE_DIRNAME, REPO_NAME, SKIP_BUILD, SOURCE_DIR, DEST_DIR, JEKYLL_ARGS + script: | + + [ "$OUTPUT_DIRNAME" = "$ORIG_DIRNAME" ] && OUTPUT_DIRNAME=$SITE_DIRNAME + + cd $SOURCE_DIR + + # If site is not there yet, clone it + [ -d "${SOURCE_DIR}/${SITE_DIRNAME}" ] || + sudo -u www-data git clone https://git.alice.ufsj.edu.br/$REPO_NAME + + # Update + cd "${SOURCE_DIR}/${SITE_DIRNAME}" + sudo -u www-data git pull + + # Build + [ $SKIP_BUILD != false ] && exit 0 + sudo -u www-data bundle install + sudo -u www-data bundle exec jekyll build $JEKYLL_ARGS --destination=$DEST_DIR/$OUTPUT_DIRNAME