diff --git a/.forgejo/workflows/deploy.yml b/.forgejo/workflows/deploy.yml new file mode 100644 index 0000000..a65c52e --- /dev/null +++ b/.forgejo/workflows/deploy.yml @@ -0,0 +1,29 @@ +--- + +on: + push: + branches: + - main + +jobs: + + deploy: + runs-on: ipv6 + env: + SSH_KNOWN_HOSTS: ${{ secrets.SSH_KNOWN_HOSTS }} + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + RSYNC_DEST: ${{ secrets.RSYNC_DEST }} + steps: + - uses: https://code.forgejo.org/actions/checkout@v4 + - name: test + run: | + apt-get update + apt-get install --yes --no-install-recommends make hugo rsync + make clean generate + - name: upload + run: | + echo "$SSH_KNOWN_HOSTS" > /ssh_known_hosts + echo "$SSH_PRIVATE_KEY" > /ssh_private_key + chmod 0600 /ssh_private_key + rsync -v --recursive --delete -e "ssh -oUserKnownHostsFile=/ssh_known_hosts -i /ssh_private_key" "public/" "$RSYNC_DEST" + diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml new file mode 100644 index 0000000..e170583 --- /dev/null +++ b/.forgejo/workflows/test.yml @@ -0,0 +1,15 @@ +--- + +on: push + +jobs: + + test: + runs-on: docker + steps: + - uses: https://code.forgejo.org/actions/checkout@v4 + - name: test + run: | + apt-get update + apt-get install --yes --no-install-recommends make hugo rsync + make clean generate diff --git a/Makefile b/Makefile index 8d358a5..caef3c4 100644 --- a/Makefile +++ b/Makefile @@ -8,11 +8,6 @@ OUTPUT_DIR := public VNU_COMMAND := vnu VNU_OPTIONS := --skip-non-html --also-check-css -# Rsync deployment configuration. -SSH_HOST := www.cosin.ch -SSH_USER := webcosin -TARGET_DIR := /srv/www/www.cosin.ch/ - # Non-file goals. .PHONY: server generate validate upload clean @@ -31,10 +26,6 @@ generate: validate: generate $(VNU_COMMAND) $(VNU_OPTIONS) $(OUTPUT_DIR) -# Deploy the website to the production webserver. -upload: generate - rsync --rsh=ssh -P -rvzc --cvs-exclude --delete $(OUTPUT_DIR)/ $(SSH_USER)@$(SSH_HOST):$(TARGET_DIR) - # Clean up. clean: rm -rf $(OUTPUT_DIR) diff --git a/readme.md b/readme.md index 22a1be9..fe74be9 100644 --- a/readme.md +++ b/readme.md @@ -22,8 +22,5 @@ and auto-reloads on content changes. Deployment ---------- -Given the necessary _ssh_ login credentials, just run: - - make upload - -to upload the static website to our webserver via _rsync_ over _ssh_. +The `master` branch is deployed to https://cosin.ch automatically via +Forgejo Actions.