mirror of
https://github.com/CPunch/openpunk-ansible.git
synced 2024-11-22 15:30:05 +00:00
Compare commits
No commits in common. "1747125b67e3cdc93b7ec87a4c316cd4d9189274" and "ca6fdaeff38820a5fec7d24f57d96d76fe4de8e4" have entirely different histories.
1747125b67
...
ca6fdaeff3
@ -4,18 +4,18 @@
|
|||||||
repo: "https://github.com/CPunch/openpunk.git"
|
repo: "https://github.com/CPunch/openpunk.git"
|
||||||
dest: "/var/www/{{ domain }}"
|
dest: "/var/www/{{ domain }}"
|
||||||
|
|
||||||
|
# TODO: make idempotent (call the updateBlog script !!)
|
||||||
|
- name: Build blog
|
||||||
|
command:
|
||||||
|
cmd: hugo
|
||||||
|
chdir: "/var/www/{{ domain }}"
|
||||||
|
|
||||||
- name: Install updateBlog script
|
- name: Install updateBlog script
|
||||||
template:
|
template:
|
||||||
src: templates/updateBlog
|
src: templates/updateBlog
|
||||||
dest: /usr/local/bin/updateBlog
|
dest: /usr/local/bin/updateBlog
|
||||||
mode: u+rx
|
mode: u+rx
|
||||||
|
|
||||||
- name: Build blog
|
|
||||||
command:
|
|
||||||
cmd: updateBlog
|
|
||||||
register: blog_out
|
|
||||||
changed_when: blog_out.stdout != "up to date"
|
|
||||||
|
|
||||||
# Rebuild blog every hour
|
# Rebuild blog every hour
|
||||||
- name: Setup blog cron job
|
- name: Setup blog cron job
|
||||||
cron:
|
cron:
|
||||||
|
@ -1,32 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
cd /var/www/{{ domain }}
|
cd /var/www/{{ domain }}
|
||||||
|
/usr/bin/git fetch origin
|
||||||
|
/usr/bin/git reset --hard origin/main
|
||||||
|
|
||||||
PUBLIC_DIR=public
|
# build sites
|
||||||
TOR_DIR=tor
|
/usr/bin/hugo --cleanDestinationDir --minify -d public -b https://{{ domain }}
|
||||||
|
/usr/bin/hugo --cleanDestinationDir --minify -d tor -b {{ onionDomain }}
|
||||||
buildBlog () {
|
|
||||||
hugo --cleanDestinationDir --minify -d $PUBLIC_DIR -b https://{{ domain }}
|
|
||||||
hugo --cleanDestinationDir --minify -d $TOR_DIR -b {{ onionDomain }}
|
|
||||||
}
|
|
||||||
|
|
||||||
git fetch origin
|
|
||||||
UPSTREAM=${1:-'@{u}'}
|
|
||||||
LOCAL=$(git rev-parse @)
|
|
||||||
REMOTE=$(git rev-parse "$UPSTREAM")
|
|
||||||
BASE=$(git merge-base @ "$UPSTREAM")
|
|
||||||
if [ $LOCAL = $REMOTE ]; then
|
|
||||||
# this string is hardcoded && checked by the 'Build blog' task
|
|
||||||
# to check for changes (changed_when)
|
|
||||||
echo "up to date"
|
|
||||||
elif [ $LOCAL = $BASE ]; then
|
|
||||||
# there are changes to reset too so we need to rebuild
|
|
||||||
echo "missing changes !!"
|
|
||||||
git reset --hard origin/main
|
|
||||||
buildBlog
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d "$PUBLIC_DIR" ] || [ ! -d "$TOR_DIR" ]; then
|
|
||||||
# probably first time setup
|
|
||||||
echo "missing directories !!"
|
|
||||||
buildBlog
|
|
||||||
fi
|
|
||||||
|
Loading…
Reference in New Issue
Block a user