mirror of
https://git.sr.ht/~seirdy/seirdy.one
synced 2024-11-23 21:02:09 +00:00
CI: use Makefile to lint, build, and deploy
Switch from the deploy.sh shell script to a more configurable Makefile.
This commit is contained in:
parent
b9d22a1510
commit
40ea94c33b
8 changed files with 71 additions and 46 deletions
|
@ -13,10 +13,7 @@ triggers:
|
|||
condition: always
|
||||
to: seirdy@seirdy.one
|
||||
tasks:
|
||||
- build: |
|
||||
cd seirdy.one
|
||||
hugo
|
||||
- upload: |
|
||||
- build_deploy: |
|
||||
cd seirdy.one
|
||||
echo "StrictHostKeyChecking=no" >> ~/.ssh/config
|
||||
sh ./deploy.sh seirdy.one
|
||||
make build deploy
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
public/
|
||||
public_*/
|
||||
hint-report/
|
||||
.hintrc-local
|
||||
|
|
9
.hintrc
9
.hintrc
|
@ -5,12 +5,15 @@
|
|||
"connector": {
|
||||
"name": "puppeteer",
|
||||
"options": {
|
||||
"browser": "Chromium",
|
||||
"headless": false
|
||||
"headless": true,
|
||||
"browser": "Chromium"
|
||||
}
|
||||
},
|
||||
"browserslist": [
|
||||
">.01%, last 2 versions, not dead"
|
||||
">0%",
|
||||
"last 8 versions",
|
||||
"not dead",
|
||||
"dead"
|
||||
],
|
||||
"hints": {
|
||||
"axe/other": "error",
|
||||
|
|
5
.rsyncignore
Normal file
5
.rsyncignore
Normal file
|
@ -0,0 +1,5 @@
|
|||
misc/
|
||||
music.txt
|
||||
music.txt.gz
|
||||
.well-known
|
||||
_*
|
4
.stylelintignore
Normal file
4
.stylelintignore
Normal file
|
@ -0,0 +1,4 @@
|
|||
public/
|
||||
public_*/
|
||||
hint-report/
|
||||
themes/etch-custom/exampleSite
|
6
.stylelintrc.json
Normal file
6
.stylelintrc.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"extends": "stylelint-config-standard",
|
||||
"rules": {
|
||||
"indentation": "tab"
|
||||
}
|
||||
}
|
47
Makefile
Normal file
47
Makefile
Normal file
|
@ -0,0 +1,47 @@
|
|||
CSS_DIR = themes/etch-custom/assets/css
|
||||
|
||||
USER = deploy@seirdy.one
|
||||
WWW_ROOT = /var/www/seirdy.one
|
||||
GEMINI_ROOT = /srv/gemini/seirdy.one
|
||||
|
||||
WWW_RSYNC_DEST = $(USER):$(WWW_ROOT)
|
||||
GEMINI_RSYNC_DEST = $(USER):$(GEMINI_ROOT)
|
||||
|
||||
OUTPUT_DIR = public/
|
||||
|
||||
RSYNCFLAGS += -avzP --zc=zstd
|
||||
|
||||
# .hintrc-local for linting local files
|
||||
# same as regular .hintrc but with a different connector.
|
||||
.hintrc-local: .hintrc
|
||||
jq --tab '.connector .name = "local" | del(.connector .options)' <.hintrc >.hintrc-local
|
||||
|
||||
clean:
|
||||
rm -rf $(OUTPUT_DIR) .hintrc-local
|
||||
|
||||
lint-css:
|
||||
stylelint $(CSS_DIR)/main.css $(CSS_DIR)/dark.css $(CSS_DIR)/narrow.css
|
||||
csslint $(CSS_DIR)
|
||||
|
||||
lint: lint-css build .hintrc-local
|
||||
hint --config .hintrc-local -f codeframe $(OUTPUT_DIR)
|
||||
|
||||
hugo:
|
||||
hugo
|
||||
|
||||
build: hugo
|
||||
ifndef NO_GZIP_STATIC
|
||||
find $(OUTPUT_DIR) -type f -name '*.html' -o -name '*.css' -o -name '*.xml' -o -name '*.txt' \
|
||||
| grep -v gemini \
|
||||
| xargs zopfli --i150 --gzip
|
||||
endif
|
||||
|
||||
|
||||
deploy: build
|
||||
rsync $(RSYNCFLAGS) --exclude 'gemini' --exclude '*.gmi' --exclude-from .rsyncignore public/ $(WWW_RSYNC_DEST) --delete
|
||||
rsync $(RSYNCFLAGS) --exclude '*.html' --exclude '*.xml' --exclude-from .rsyncignore public/gemini/ public/about public/posts public/publickey.txt $(GEMINI_RSYNC_DEST)/
|
||||
rsync $(RSYNCFLAGS) public/posts/gemini.xml $(GEMINI_RSYNC_DEST)/feed.xml
|
||||
|
||||
all: clean lint deploy
|
||||
|
||||
.PHONY: clean lint-css lint build deploy all
|
38
deploy.sh
38
deploy.sh
|
@ -1,38 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
case "$1" in
|
||||
seirdy.one)
|
||||
login='deploy@seirdy.one' # user@host
|
||||
www_prefix="$login:/var/www/seirdy.one"
|
||||
gemini_prefix="$login:/srv/gemini/seirdy.one"
|
||||
;;
|
||||
envs.net)
|
||||
login='seirdy@envs.net'
|
||||
www_prefix="$login:/home/seirdy/public_html"
|
||||
gemini_prefix="$login:/home/seirdy/public_gemini"
|
||||
;;
|
||||
localhost)
|
||||
www_prefix='/tmp/www/seeirdy.one'
|
||||
gemini_prefix='/tmp/gemini/serve/seirdy.one'
|
||||
mkdir -p "$www_prefix" "$gemini_prefix"
|
||||
;;
|
||||
*)
|
||||
echo 'must supply hostname' >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# I use gzip_static with nginx
|
||||
if [ "$1" = 'seirdy.one' ]; then
|
||||
find public -type f -name '*.html' -o -name '*.css' -o -name '*.xml' -o -name '*.txt' \
|
||||
| grep -v gemini \
|
||||
| xargs zopfli
|
||||
fi
|
||||
|
||||
rsync -avzP \
|
||||
--exclude 'gemini' --exclude '*.gmi' --exclude 'misc/' --exclude 'music.txt' --exclude '.well-known' \
|
||||
public/ "$www_prefix/" --delete
|
||||
rsync -avzP \
|
||||
--exclude '*.html' --exclude 'misc/' --exclude 'music.txt' --exclude '*.xml' \
|
||||
public/gemini/ public/about public/posts public/publickey.txt "$gemini_prefix/" --delete
|
||||
rsync -avzP public/posts/gemini.xml "$gemini_prefix/feed.xml"
|
Loading…
Reference in a new issue