From 274c66071dfc04dff35c5892a1c1e2db518fb734 Mon Sep 17 00:00:00 2001 From: ssp6904 Date: Thu, 25 Jul 2024 15:41:08 -0400 Subject: [PATCH] Added action files and workflows Signed-off-by: ssp6904 --- generators/jekyll.yml | 13 +++++++++++++ pages/pages.yml | 11 +++++++++++ pages/run.sh | 38 ++++++++++++++++++++++++++++++++++++++ simple/greeting.yml | 6 ++++++ 4 files changed, 68 insertions(+) create mode 100644 generators/jekyll.yml create mode 100644 pages/pages.yml create mode 100644 pages/run.sh create mode 100644 simple/greeting.yml diff --git a/generators/jekyll.yml b/generators/jekyll.yml new file mode 100644 index 0000000..fd6f1e8 --- /dev/null +++ b/generators/jekyll.yml @@ -0,0 +1,13 @@ +steps: + buildsite: + image: ruby + commands: + - chmod -R a+w . + - gem install bundler + - bundle install + - bundle exec jekyll build + pushsite: + image: ubuntu + commands: + - ls -ltr _site + - echo "TBA" \ No newline at end of file diff --git a/pages/pages.yml b/pages/pages.yml new file mode 100644 index 0000000..9884ec4 --- /dev/null +++ b/pages/pages.yml @@ -0,0 +1,11 @@ +steps: + pushme: + image: ubuntu + commands: + - chmod -R a+w . + - apt update + - apt install -y git wget + - wget https://git.ttnrtsite.me/TTNRT/actions/pages/run.sh + - chmod +x run.sh + - bash run.sh + - echo "Done!" \ No newline at end of file diff --git a/pages/run.sh b/pages/run.sh new file mode 100644 index 0000000..ebc570d --- /dev/null +++ b/pages/run.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +set -eo pipefail + +check_command() { + command -v "$1" >/dev/null 2>&1 +} + +if ! check_command git; then + echo "git not found, please install it!" + exit 1 +fi + +if [ $# -ne 1 ]; then + echo "Usage: $(basename "$0") " + exit 1 +fi + +git config --global user.email "hoffershaun842@gmail.com" +git config --global user.name "TTGit Automation Bot" +git config --global --add --bool push.autoSetupRemote true + +if ! git ls-remote --exit-code --heads origin pages; then + git checkout --orphan pages + git rm -rf . +else + git checkout pages +fi + +if ! [ -d "$1" ]; then + echo "$1 does not exist! Try setting inputs.path" + exit 1 +fi + +cp -r "$1"/* . && rm -rf "$1" +git add -A +git commit -a -m "TTPages: Automated Update" +git push -u diff --git a/simple/greeting.yml b/simple/greeting.yml new file mode 100644 index 0000000..df862c9 --- /dev/null +++ b/simple/greeting.yml @@ -0,0 +1,6 @@ +steps: + greeting: + image: ubuntu + commands: + - echo "Hello there! I'm a pipline that runs on TTGit" + - echo "Use me for workflows when you need to!" \ No newline at end of file