From f5c8c7a73744b844075a2af3fae88465e29a434f Mon Sep 17 00:00:00 2001 From: Aravinth Manivannan Date: Sun, 18 Dec 2022 22:35:55 +0530 Subject: [PATCH] fix: CI: clear repo before publishing site --- libconfig-validator/Makefile | 5 ++--- libconfig-validator/scripts/ci.sh | 6 +++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/libconfig-validator/Makefile b/libconfig-validator/Makefile index df5bdb0..218ac7c 100644 --- a/libconfig-validator/Makefile +++ b/libconfig-validator/Makefile @@ -8,10 +8,9 @@ ci-deploy: ## Deploy from CI/CD. Only call from within CI fi git config --global user.email "${CI_COMMIT_AUTHOR_EMAIL}" git config --global user.name "${CI_COMMIT_AUTHOR}" - ./scripts/ci.sh --publish librepages dist "${CI_COMMIT_AUTHOR} <${CI_COMMIT_AUTHOR_EMAIL}>" + find ./scripts/ci.sh --init "$$GITEA_WRITE_DEPLOY_KEY" - ./scripts/ci.sh --deploy ${LIBREPAGES_DEPLOY_SECRET} librepages - ./scripts/ci.sh --clean + ./scripts/ci.sh --deploy librepages dist "${CI_COMMIT_AUTHOR} <${CI_COMMIT_AUTHOR_EMAIL}>" ${LIBREPAGES_DEPLOY_SECRET} librepages lint: ## Lint codebase cargo fmt -v --all -- --emit files diff --git a/libconfig-validator/scripts/ci.sh b/libconfig-validator/scripts/ci.sh index 90b8c70..0b7ab88 100755 --- a/libconfig-validator/scripts/ci.sh +++ b/libconfig-validator/scripts/ci.sh @@ -89,6 +89,7 @@ write_to_branch() { git switch $1 fi + cd .. git rm -rf . /bin/rm -rf * cp -r $tmp_dir/* . @@ -101,6 +102,7 @@ write_to_branch() { --message="new deploy: $(date --iso-8601=seconds)" fi git checkout $original_branch + find } # $1: Pages API secret @@ -148,7 +150,9 @@ then help exit -1 fi - deploy $2 $3 + write_to_branch $2 $3 $4 + deploy $5 $6 + clean elif match_arg $1 '-h' '--help' then help