From c8c26c1706c5804acb3ca587e05c99c2ddf818f0 Mon Sep 17 00:00:00 2001 From: Aaron Axvig Date: Sat, 25 Jul 2026 22:14:40 -0500 Subject: [PATCH] Deploy site with Gitea Actions --- .gitea/workflows/deploy.yml | 60 +++++++++++++++++++++++++++++++++++++ README.md | 17 +++++++++++ 2 files changed, 77 insertions(+) create mode 100644 .gitea/workflows/deploy.yml diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..60562c0 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,60 @@ +name: Check and deploy + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + deploy: + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - name: Check out the site + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Validate the site + run: npm run check + + - name: Assemble the static site + run: | + install -d dist + cp index.html styles.css dist/ + cp -R src vendor tiles dist/ + + - name: Install deployment tools + run: | + apt-get update + apt-get install --yes --no-install-recommends openssh-client rsync + + - name: Configure deployment SSH key + env: + DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }} + DEPLOY_KNOWN_HOSTS: ${{ secrets.DEPLOY_KNOWN_HOSTS }} + run: | + install -d -m 0700 "$HOME/.ssh" + printf '%s\n' "$DEPLOY_SSH_KEY" > "$HOME/.ssh/deploy_key" + printf '%s\n' "$DEPLOY_KNOWN_HOSTS" > "$HOME/.ssh/known_hosts" + chmod 0600 "$HOME/.ssh/deploy_key" "$HOME/.ssh/known_hosts" + + - name: Upload the website + env: + DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }} + run: | + rsync \ + --archive \ + --compress \ + --delete \ + --delay-updates \ + --human-readable \ + --itemize-changes \ + --rsh "ssh -i $HOME/.ssh/deploy_key -o IdentitiesOnly=yes" \ + dist/ \ + "a-plot-of-plants-deploy@${DEPLOY_HOST}:/var/www/html/a-plot-of-plants/" diff --git a/README.md b/README.md index 7086abb..a3292c3 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,23 @@ python3 -m http.server 4173 Then open . +## Automatic deployment + +Gitea Actions validates and publishes the website after every push to `main`. +The workflow in [`.gitea/workflows/deploy.yml`](.gitea/workflows/deploy.yml) +assembles only the runtime files and syncs them to +`a-plot-of-plants-deploy@:/var/www/html/a-plot-of-plants/`. +It can also be run manually from the Actions page. + +The workflow requires these repository Actions secrets: + +- `DEPLOY_HOST`: the web server hostname or IP address as reached by the runner. +- `DEPLOY_SSH_KEY`: the complete private deployment key. +- `DEPLOY_KNOWN_HOSTS`: the web server's verified SSH host-key line. + +The deployment deliberately excludes Git metadata, authoring documentation, +the source GeoPackage, and other development-only files. + ## Zoom behavior Both the yard overlays and the local basemap are vector data, so linework stays