From 030221f2582a6721dfd9297828acd7b7e1a5aefa Mon Sep 17 00:00:00 2001 From: Aravinth Manivannan Date: Thu, 27 Oct 2022 23:55:37 +0530 Subject: [PATCH] fix: mv website/* . and fix publish pipeline --- website/.gitignore => .gitignore | 0 .woodpecker.yml | 2 -- website/Makefile => Makefile | 1 + website/config.toml => config.toml | 0 {website/sass => sass}/main.scss | 1 - {website/scripts => scripts}/ci.sh | 21 +++++++++++++++++++- {website/scripts => scripts}/lib.sh | 0 {website/scripts => scripts}/prep.sh | 2 +- {website/scripts => scripts}/spellcheck.sh | 0 {website/scripts => scripts}/zola.sh | 3 +++ {website/static => static}/logo.png | Bin {website/templates => templates}/404.html | 0 {website/templates => templates}/index.html | 0 13 files changed, 25 insertions(+), 5 deletions(-) rename website/.gitignore => .gitignore (100%) rename website/Makefile => Makefile (96%) rename website/config.toml => config.toml (100%) rename {website/sass => sass}/main.scss (98%) rename {website/scripts => scripts}/ci.sh (87%) rename {website/scripts => scripts}/lib.sh (100%) rename {website/scripts => scripts}/prep.sh (96%) rename {website/scripts => scripts}/spellcheck.sh (100%) rename {website/scripts => scripts}/zola.sh (98%) rename {website/static => static}/logo.png (100%) rename {website/templates => templates}/404.html (100%) rename {website/templates => templates}/index.html (100%) diff --git a/website/.gitignore b/.gitignore similarity index 100% rename from website/.gitignore rename to .gitignore diff --git a/.woodpecker.yml b/.woodpecker.yml index 0d9fdc2..07649b4 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -4,7 +4,6 @@ pipeline: when: event: [push, pull_request, tag, deployment] commands: - - cd website - make env - make @@ -15,7 +14,6 @@ pipeline: branch: main commands: - pwd - - cd website - pwd - make ci-deploy secrets: [repo_write_deploy_key] diff --git a/website/Makefile b/Makefile similarity index 96% rename from website/Makefile rename to Makefile index e728290..ebd4465 100644 --- a/website/Makefile +++ b/Makefile @@ -15,6 +15,7 @@ ci-deploy: ## Deploy from CI/CD. Only call from within CI git config --global user.name "${CI_COMMIT_AUTHOR}" ./scripts/zola.sh deploy pages public "${CI_COMMIT_AUTHOR} <${CI_COMMIT_AUTHOR_EMAIL}>" ./scripts/ci.sh --init "$$REPO_WRITE_DEPLOY_KEY" + ./scripts/ci.sh --deploy pages ./scripts/ci.sh --clean env: ## Download build dependencies and setup dev environment diff --git a/website/config.toml b/config.toml similarity index 100% rename from website/config.toml rename to config.toml diff --git a/website/sass/main.scss b/sass/main.scss similarity index 98% rename from website/sass/main.scss rename to sass/main.scss index 7b9b002..d265a3c 100644 --- a/website/sass/main.scss +++ b/sass/main.scss @@ -1,5 +1,4 @@ /* Basic */ -@import url("https://fonts.googleapis.com/css?family=Montserrat&display=swap"); html { font-family: 400 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Segoe UI Symbol", "Segoe UI Emoji", "Apple Color Emoji", Roboto, diff --git a/website/scripts/ci.sh b/scripts/ci.sh similarity index 87% rename from website/scripts/ci.sh rename to scripts/ci.sh index 9b67764..2f6c855 100755 --- a/website/scripts/ci.sh +++ b/scripts/ci.sh @@ -55,7 +55,6 @@ set_ssh_remote() { remote_hostname=$(echo $http_remote_url | cut -d '/' -f 3) repository_owner=$(echo $http_remote_url | cut -d '/' -f 4) repository_name=$(echo $http_remote_url | cut -d '/' -f 5) - ssh_remote="git@$remote_hostname:$repository_owner/$repository_name" ssh_remote="git@codeberg.org:SocialCoding/gitea-open-letter.git" git remote add $SSH_REMOTE_NAME $ssh_remote } @@ -68,6 +67,18 @@ clean() { fi } + +# $2: Deployment target branch +deploy() { + if (( "$#" < 1 )) + then + help + else + git -c core.sshCommand="/usr/bin/ssh -oStrictHostKeyChecking=no -i $SSH_ID_FILE"\ + push --force $SSH_REMOTE_NAME $1 + fi +} + if (( "$#" < 1 )) then help @@ -87,6 +98,14 @@ then elif match_arg $1 '-c' '--clean' then clean +elif match_arg $1 '-d' '--deploy' +then + if (( "$#" < 2 )) + then + help + exit -1 + fi + deploy $2 elif match_arg $1 '-h' '--help' then help diff --git a/website/scripts/lib.sh b/scripts/lib.sh similarity index 100% rename from website/scripts/lib.sh rename to scripts/lib.sh diff --git a/website/scripts/prep.sh b/scripts/prep.sh similarity index 96% rename from website/scripts/prep.sh rename to scripts/prep.sh index 5d684ac..cbfcefc 100755 --- a/website/scripts/prep.sh +++ b/scripts/prep.sh @@ -28,7 +28,7 @@ init() { echo 'title = "Gitea Open Letter"' >> $file echo "+++" >> $file echo "" >> $file - cat ../README.md | tail -n +5 >> $file + cat README.md | tail -n +5 >> $file } init diff --git a/website/scripts/spellcheck.sh b/scripts/spellcheck.sh similarity index 100% rename from website/scripts/spellcheck.sh rename to scripts/spellcheck.sh diff --git a/website/scripts/zola.sh b/scripts/zola.sh similarity index 98% rename from website/scripts/zola.sh rename to scripts/zola.sh index 2d1cabe..20ef4c6 100755 --- a/website/scripts/zola.sh +++ b/scripts/zola.sh @@ -96,6 +96,7 @@ deploy() { cd $PROJECT_ROOT original_branch=$(git branch --show-current) tmp_dir=$(mktemp -d) + cp .domains $tmp_dir cp -r $2/* $tmp_dir if [[ -z $(git ls-remote --heads origin ${1}) ]] @@ -111,6 +112,8 @@ deploy() { git rm -rf . /bin/rm -rf * cp -r $tmp_dir/* . + cp -r $tmp_dir/.domains . + git add .domains git add --all if [ $(git status --porcelain | xargs | sed '/^$/d' | wc -l) -gt 0 ]; then diff --git a/website/static/logo.png b/static/logo.png similarity index 100% rename from website/static/logo.png rename to static/logo.png diff --git a/website/templates/404.html b/templates/404.html similarity index 100% rename from website/templates/404.html rename to templates/404.html diff --git a/website/templates/index.html b/templates/index.html similarity index 100% rename from website/templates/index.html rename to templates/index.html