From de65f4d5061ecf000207931936ea2b022febace7 Mon Sep 17 00:00:00 2001 From: Rohan Kumar Date: Fri, 24 Nov 2023 12:58:45 -0800 Subject: [PATCH] Move some CI logic to scripts/makefile Also update some of its docs --- .build.yml | 19 ++++++------------- Makefile | 6 ++++++ scripts/setup-ci.sh | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 13 deletions(-) create mode 100644 scripts/setup-ci.sh diff --git a/.build.yml b/.build.yml index bf3cd81..a20745f 100644 --- a/.build.yml +++ b/.build.yml @@ -1,13 +1,13 @@ --- # we rsync binaries.tar.gz from the same server we deploy to. # it contains these static-pie binaries: -# hugo, brotli, ect (like gzip/zopfli), sd, htmlq (like jq for html), and xmllint. +# hugo, brotli, ect (like gzip/zopfli), and xmllint. image: alpine/edge packages: - - curl # for webring update script, pre-installed on builds.sr.ht images + - curl # Fetches webmentions and webring links. Pre-inistalled. - rsync - - git # for Hugo's gitInfo, pre-installed on builds.sr.ht images - - bmake + - git # Powers Hugo's gitInfo. Pre-installed + - bmake # gmake is fine too sources: - https://git.sr.ht/~seirdy/seirdy.one secrets: @@ -19,14 +19,7 @@ triggers: to: seirdy@seirdy.one tasks: - deps: | - printf "VerifyHostKeyDNS=yes\nKexAlgorithms=sntrup761x25519-sha512@openssh.com\n" >> ~/.ssh/config - # mirrored at https://seirdy.one/misc/binaries.tar.gz - rsync -Wv deploy@seirdy.one:/var/www/pb/binaries.tar.gz . - mkdir -p ~/bin - tar xzf binaries.tar.gz -oC ~/bin + sh seirdy.one/scripts/setup-ci.sh - build_deploy: | cd seirdy.one - export PATH=~/bin:$PATH - # quick health + ip check - sh scripts/connectivity-check.sh - bmake deploy-prod deploy-onion + bmake ci diff --git a/Makefile b/Makefile index 94ebca8..71def87 100644 --- a/Makefile +++ b/Makefile @@ -163,6 +163,12 @@ deploy-onion: @$(MAKE) WWW_ROOT=/var/www/seirdy.onion HUGO_BASEURL='http://wgq3bd2kqoybhstp77i3wrzbfnsyd27wt34psaja4grqiezqircorkyd.onion/' OUTPUT_DIR=public_onion copy-to-xhtml @$(MAKE) WWW_ROOT=/var/www/seirdy.onion HUGO_BASEURL='http://wgq3bd2kqoybhstp77i3wrzbfnsyd27wt34psaja4grqiezqircorkyd.onion/' OUTPUT_DIR=public_onion deploy-html +# in CI, check connectivity and then build + deploy the clearnet and onion sites. +.PHONY: ci +ci: + sh scripts/connectivity-check.sh + @$(MAKE) deploy-prod deploy-onion + # we only deploy html to the staging site .PHONY: deploy-staging deploy-staging: diff --git a/scripts/setup-ci.sh b/scripts/setup-ci.sh new file mode 100644 index 0000000..a4bc066 --- /dev/null +++ b/scripts/setup-ci.sh @@ -0,0 +1,14 @@ +#!/bin/sh +# For CI: configures SSH and installs binaries that I use to build my site. +# The binaries are statically-linked for Linux on x86_64 +set -e -u + +# configure ssh +echo "VerifyHostKeyDNS=yes +KexAlgorithms=sntrup761x25519-sha512@openssh.com" >> ~/.ssh/config + +# mirrored at https://seirdy.one/pb/binaries.tar.gz +rsync -WPv deploy@seirdy.one:/var/www/pb/binaries.tar.gz . +mkdir -p /usr/local/bin +tar xzf binaries.tar.gz -oC /usr/local/bin +rm binaries.tar.gz