feat(tooling): add actions workflow for test build and deploy
This commit is contained in:
parent
15cd63fc6c
commit
0e96b3a37f
3 changed files with 41 additions and 7 deletions
34
.forgejo/workflows/main.yaml
Normal file
34
.forgejo/workflows/main.yaml
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
---
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'main'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
all:
|
||||||
|
runs-on: 'self-hosted'
|
||||||
|
steps:
|
||||||
|
- uses: 'actions/checkout@v4'
|
||||||
|
- uses: 'actions/setup-go@v5'
|
||||||
|
with:
|
||||||
|
go-version-file: 'search/go.mod'
|
||||||
|
- name: 'fmt'
|
||||||
|
run: |
|
||||||
|
make tidy no-dirty
|
||||||
|
- name: 'check'
|
||||||
|
run: |
|
||||||
|
make check no-dirty
|
||||||
|
- name: 'build'
|
||||||
|
run: |
|
||||||
|
make build
|
||||||
|
- name: 'deploy'
|
||||||
|
run: |
|
||||||
|
umask 077
|
||||||
|
printf '%s' "$SSH_PRIVATE_KEY" | base64 -d > private_key
|
||||||
|
SSHOPTS="-i private_key -o StrictHostKeyChecking=accept-new"
|
||||||
|
rsync -a --delete -e "ssh ${SSHOPTS}" public/ www@www.adyxax.org:/srv/www/public/
|
||||||
|
rsync -e "ssh ${SSHOPTS}" search/search www@www.adyxax.org:/srv/www/
|
||||||
|
ssh ${SSHOPTS} www@www.adyxax.org "chmod +x search; systemctl --user restart www-search"
|
||||||
|
env:
|
||||||
|
SSH_PRIVATE_KEY: '${{ secrets.SSH_PRIVATE_KEY }}'
|
12
GNUmakefile
12
GNUmakefile
|
@ -8,7 +8,6 @@ SHELL := bash
|
||||||
|
|
||||||
##### Variables ################################################################
|
##### Variables ################################################################
|
||||||
CACHEDIR := /tmp/hugo-cache-$(USER)
|
CACHEDIR := /tmp/hugo-cache-$(USER)
|
||||||
DESTDIR := public/
|
|
||||||
HOSTNAME := $(shell hostname -f)
|
HOSTNAME := $(shell hostname -f)
|
||||||
REVISION := $(shell git rev-parse HEAD)
|
REVISION := $(shell git rev-parse HEAD)
|
||||||
|
|
||||||
|
@ -17,7 +16,7 @@ REVISION := $(shell git rev-parse HEAD)
|
||||||
build: ## make build
|
build: ## make build
|
||||||
# TODO make sure to stash everything in content/ ?
|
# TODO make sure to stash everything in content/ ?
|
||||||
@echo "----- Generating site -----"
|
@echo "----- Generating site -----"
|
||||||
hugo --gc --minify --cleanDestinationDir -d $(DESTDIR) \
|
hugo --gc --minify --cleanDestinationDir -d public/ \
|
||||||
--cacheDir $(CACHEDIR) --buildFuture
|
--cacheDir $(CACHEDIR) --buildFuture
|
||||||
cp public/index.json search/
|
cp public/index.json search/
|
||||||
cp public/search/index.html search/
|
cp public/search/index.html search/
|
||||||
|
@ -28,7 +27,7 @@ build: ## make build
|
||||||
clean: ## make clean
|
clean: ## make clean
|
||||||
@echo "----- Cleaning old build -----"
|
@echo "----- Cleaning old build -----"
|
||||||
rm -f search/index.html search/index.json search/search
|
rm -f search/index.html search/index.json search/search
|
||||||
rm -rf $(DESTDIR)
|
rm -rf public
|
||||||
|
|
||||||
.PHONY: serve
|
.PHONY: serve
|
||||||
serve: ## make serve # hugo web server development mode
|
serve: ## make serve # hugo web server development mode
|
||||||
|
@ -39,9 +38,10 @@ serve: ## make serve # hugo web server development mode
|
||||||
##### Operations ###############################################################
|
##### Operations ###############################################################
|
||||||
.PHONY: deploy
|
.PHONY: deploy
|
||||||
deploy: ## make deploy
|
deploy: ## make deploy
|
||||||
rsync -a $(DESTDIR) root@www.adyxax.org:/srv/www/
|
# TODO change to www@www.adyxax.org
|
||||||
rsync search/search root@www.adyxax.org:/usr/local/bin/www-search
|
rsync -a --delete public/ www@www.adyxax.org:/srv/www/public/
|
||||||
ssh root@www.adyxax.org "systemctl restart www-search"
|
rsync search/search www@www.adyxax.org:/srv/www/
|
||||||
|
ssh www@www.adyxax.org "systemctl --user restart www-search"
|
||||||
|
|
||||||
##### Quality ##################################################################
|
##### Quality ##################################################################
|
||||||
.PHONY: check
|
.PHONY: check
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
title: 'Migrating gotosocial from nixos to Debian'
|
title: 'Migrating gotosocial from NixOS to Debian'
|
||||||
description: 'How I am deploying gotosocial with ansible'
|
description: 'How I am deploying gotosocial with ansible'
|
||||||
date: '2025-03-16'
|
date: '2025-03-16'
|
||||||
tags:
|
tags:
|
||||||
|
|
Loading…
Add table
Reference in a new issue