From 129c3958237b095f3ed36b637488b365e8a4f14f Mon Sep 17 00:00:00 2001 From: app-harry Date: Sat, 26 Oct 2024 23:59:10 +0800 Subject: [PATCH] update deploy.sh --- .DS_Store | Bin 8196 -> 6148 bytes deploy.sh | 49 +++++++++++++++++++++++++++++++++++ scaffold/config.rb | 62 --------------------------------------------- 3 files changed, 49 insertions(+), 62 deletions(-) create mode 100755 deploy.sh delete mode 100644 scaffold/config.rb diff --git a/.DS_Store b/.DS_Store index 155e9a4ee3e1176fd4e94c827e3f74b935c91301..87729e4e254cefb36dc6349210935c576f079367 100644 GIT binary patch delta 119 zcmZp1XfcprU|?W$DortDU=RQ@Ie-{Mvv5r;6q~50$jGxXU^g=(&tx8fkBkhH{|QW< zEHC^D$l?;|+*rlLxR{-TLy#G$0SE-RfrKka@5aLK%#- /dev/null; then + echo "Branch '$PAGES_BRANCH' exists. Deleting and recreating it..." + git branch -D "$PAGES_BRANCH" # Delete the branch + fi + + # Create and switch to the branch + git checkout -b "$PAGES_BRANCH" +} + +deploy() { + git config --global user.name "ZhgChgLiBot" + git config --global user.email "no-reply@zhgchg.li" + + git update-ref -d HEAD + git add -A + git commit -m "[Automation] Site update No.${GITHUB_RUN_NUMBER}" + + git push -u origin "$PAGES_BRANCH" +} + +main() { + init + build + setup_gh + deploy +} + +main diff --git a/scaffold/config.rb b/scaffold/config.rb deleted file mode 100644 index 9f9b776..0000000 --- a/scaffold/config.rb +++ /dev/null @@ -1,62 +0,0 @@ -require 'yaml' - -class Config - attr_reader :theme, :title, :avatar, :name, :tagline, :links, :social, :footer - - class Link - attr_reader :title, :url, :target, :alt - - def initialize(title, url, target, alt) - @title = title - @url = url - @target = target - @alt = alt - end - end - - class Social - attr_reader :type, :data - - def initialize(social) - @type = social.keys - @data = social.values - end - end - - def initialize(file_path = 'config.yml') - if File.exist?(file_path) - config = YAML.load_file(file_path) - puts "#{file_path} loaded successfully." - else - raise "Error: #{file_path} not found." - end - - settings = YAML.load_file(file_path) || {} - - @theme = settings["theme"] || "default" - @title = settings["title"] - @avatar = settings["avatar"] - @name = settings["name"] - @tagline = settings["tagline"] - @footer = settings["footer"] - - links = [] - if !settings["links"].nil? - settings["links"].each do |link| - links.push(Link.new(link["link"]["title"], link["link"]["url"], link["link"]["target"], link["link"]["alt"])) - end - end - @links = links - - socials = [] - if !settings["socials"].nil? - settings["socials"].each do |social| - socials.push(Social.new(social)) - end - end - @socials = socials - - - - end -end