switch to droneCI

main
Evan Hemsley 2020-07-18 03:20:49 -07:00
parent af87280859
commit 9176c395f4
4 changed files with 33 additions and 49 deletions

View File

@ -1,46 +0,0 @@
version: 2
jobs:
build:
docker:
- image: cibuilds/hugo:0.57
working_directory: ~/project
environment:
BRANCH: master
TARGET_REPO: moontools-docs/moontools-docs.github.io.git
DOCS_CHECKOUT_DIR: ~/docs
HUGO_BUILD_DIR: ~/build
steps:
- checkout
- run:
command: git submodule sync && git submodule update --init
- run:
name: "Run Hugo"
command: HUGO_ENV=production hugo -v -d $HUGO_BUILD_DIR
- deploy:
name: "Deploy website"
command: |
if [ "${CIRCLE_BRANCH}" = "master" ]; then
echo -e "Starting to deploy to Github Pages\n"
cd ~/project
git config --global user.email "builds@circleci.com"
git config --global user.name "CircleCI"
#using token clone gh-pages branch
git clone --quiet --branch=$CIRCLE_BRANCH https://${GH_TOKEN}@github.com/$TARGET_REPO $DOCS_CHECKOUT_DIR > /dev/null
#rsync
echo "rsync built code with checked out code..."
rsync -a --exclude=.git --delete $HUGO_BUILD_DIR/ $DOCS_CHECKOUT_DIR/bonk
#add, commit and push files
echo "add files to git..."
cd $DOCS_CHECKOUT_DIR
git add --all
echo "commit files to git repository..."
if git commit -m "CircleCI build $CIRCLE_BUILD_NUM pushed to Github Pages" ; then
echo "git push files with force..."
git push -fq origin $BRANCH > /dev/null
echo -e "Deploy completed\n"
else
echo "Content not changed, nothing to deploy"
fi
else
echo "Not master branch, dry run only"
fi

30
.drone.yml Normal file
View File

@ -0,0 +1,30 @@
kind: pipeline
type: docker
name: default
steps:
- name: submodules
image: alpine/git
commands:
- git submodule update --recursive --init
- name: build
image: plugins/hugo
settings:
validate: true
url: http://moonside.games/docs/bonk
- name: deploy
image: drillster/drone-rsync
settings:
hosts:
- moonside.games
target: /var/www/html/docs/bonk
source: public/
recursive: true
user: hugo
key:
from_secret: rsync_key
when:
branch:
- main

View File

@ -1,4 +1,4 @@
baseURL = "https://moontools-docs.github.io/bonk/"
baseURL = "http://moonside.games/docs/bonk/"
languageCode = "en-us"
title = "Bonk Docs"
theme = "hugo-theme-learn"
@ -8,4 +8,4 @@ home = ["HTML", "RSS", "JSON"]
[params]
themeVariant = "bonk"
author = "Evan Hemsley"
author = "Evan Hemsley"

@ -1 +1 @@
Subproject commit b85d51a051745cf12e3a45ce61b4b0c747c5ea4a
Subproject commit 3efb32712c5cc77e644852d13ce3525780374b10