Compare commits

...

22 Commits

Author SHA1 Message Date
8a94fe0add THE PRIVATE KEEEEEEEYYY
All checks were successful
Deploy website on production server when committing on main / test (push) Successful in 11s
2026-02-01 19:25:29 +01:00
2f2c60126c feat(deploy): improve environment variable handling and deployment workflow
Some checks failed
Deploy website on production server when committing on main / test (push) Failing after 12s
- Update .vars to properly export deployment configuration variables
- Modify deploy.sh to conditionally source .vars only in interactive mode
- Remove include directive from makefile to prevent automatic variable loading
- Enhance deployment script reliability by ensuring proper environment setup
2026-02-01 19:24:37 +01:00
83728057ee stupid variables
Some checks failed
Deploy website on production server when committing on main / test (push) Failing after 9s
2026-02-01 19:19:36 +01:00
4f16efe7ed ssh key is handled by the job
Some checks failed
Deploy website on production server when committing on main / test (push) Failing after 8s
2026-02-01 19:13:29 +01:00
289e06d6c3 fuck you
Some checks failed
Deploy website on production server when committing on main / test (push) Failing after 8s
2026-02-01 19:12:14 +01:00
94469a598b omfg the ci
Some checks failed
Deploy website on production server when committing on main / test (push) Failing after 8s
2026-02-01 19:11:20 +01:00
50cd2ae16f try this
Some checks failed
Deploy website on production server when committing on main / test (push) Failing after 9s
2026-02-01 19:08:02 +01:00
53795cf5cd removed debug, fixed deployment env
Some checks failed
Deploy website on production server when committing on main / test (push) Failing after 9s
2026-02-01 19:06:40 +01:00
4fa2be1351 stderr
Some checks failed
Deploy website on production server when committing on main / test (push) Failing after 8s
2026-02-01 19:02:44 +01:00
d1465de486 updated theme
Some checks failed
Deploy website on production server when committing on main / test (push) Failing after 8s
2026-02-01 18:56:14 +01:00
2e333ce882 added verbosity
Some checks failed
Deploy website on production server when committing on main / test (push) Failing after 12s
2026-02-01 18:50:36 +01:00
9463c44034 feat(deploy): improve ssh key handling and deployment security
Some checks failed
Deploy website on production server when committing on main / test (push) Failing after 9s
- Remove hardcoded SSH private key file path from workflow
- Use proper SSH directory structure (~/.ssh/) for key storage
- Add known_hosts file for improved SSH security
- Move environment variables to dedicated env block
- Remove StrictHostKeyChecking=no for better security
- Update deploy script to use proper SSH key path
- Maintain deployment path configuration via environment variables
2026-02-01 18:35:37 +01:00
b7286eeeb6 fix: use explicit bash path in makefile scripts
Specify full path to bash interpreter for version.sh and deploy.sh scripts in makefile to ensure consistent execution across different environments and avoid potential PATH issues.
2026-02-01 18:17:37 +01:00
9a4bdf15a3 fix: update deployment workflow concurrency settings
Configure concurrency group for website deployment workflow to prevent race conditions and ensure orderly deployment execution. The cancel-in-progress setting is set to false to maintain deployment stability.
2026-02-01 18:16:51 +01:00
fafafb0d37 chore: update deployment trigger from branch push to tag push
Change deployment workflow to trigger on tag pushes instead of main branch pushes, allowing for more controlled and versioned deployments.
2026-02-01 18:16:20 +01:00
d0189c57a5 fix(deploy): remove docker compose restart from deployment script
Removes the 'docker compose restart' command from the deployment script as it was causing unnecessary service interruptions during deployment. The tar extraction and cleanup steps are sufficient for updating the application files without requiring a full container restart.
2026-02-01 18:12:28 +01:00
126bd66ddb and now the build passes with zero errors
Some checks failed
Deploy website on production server when committing on main / test (push) Failing after 10s
(until I shit my pants again with some other shenanigans)
2024-08-21 23:16:03 +02:00
ec6bbafb2e no, as it turns out, variables were not defined
All checks were successful
Deploy website on production server when committing on main / test (push) Successful in 8s
2024-08-21 23:15:08 +02:00
80b3490e37 are variables actually defined?
Some checks failed
Deploy website on production server when committing on main / test (push) Failing after 7s
2024-08-21 23:14:15 +02:00
0c6699e211 does it build on the CI now with submodules?
Some checks failed
Deploy website on production server when committing on main / test (push) Failing after 8s
2024-08-21 23:10:34 +02:00
911d274467 fucking ubuntu shit outdated repos, fuck canonical
Some checks failed
Deploy website on production server when committing on main / test (push) Failing after 11s
2024-08-21 23:03:26 +02:00
3a7beeade5 apt update, of course, now install hugo!
Some checks failed
Deploy website on production server when committing on main / test (push) Failing after 9s
2024-08-21 22:38:18 +02:00
5 changed files with 46 additions and 30 deletions

View File

@@ -1,11 +1,13 @@
--- ---
name: Deploy website on production server when committing on main name: Deploy website on production server when committing on main
concurrency: 1 concurrency:
group: deploy-website
cancel-in-progress: false
on: on:
push: push:
branches: tags:
- main - '*'
defaults: defaults:
run: run:
@@ -15,14 +17,25 @@ jobs:
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- run: echo "${{ secrets.SSH_PRIVATE_KEY }}" > /private.key
- run: chmod 600 /private.key
- run: sudo apt install hugo
- uses: actions/checkout@v4
- run: APP_VERSION=latest make
- run: | - run: |
SSH_PRIVATE_KEY=/private.key export HUGO_VERSION=$(curl --silent -I https://github.com/gohugoio/hugo/releases/latest | grep location | sed 's|.*tag/||' | tr -d '\r')
SSH_USERNAME=${{ secrets.SSH_USERNAME }} export HUGO_VERSION_SHORT=$(echo ${HUGO_VERSION} | sed 's/v//')
DEPLOYMENT_HOST=${{ secrets.DEPLOYMENT_HOST }} wget https://github.com/gohugoio/hugo/releases/download/${HUGO_VERSION}/hugo_${HUGO_VERSION_SHORT}_linux-amd64.deb
DEPLOYMENT_PATH=${{ secrets.DEPLOYMENT_PATH }} dpkg -i hugo_*.deb
- uses: actions/checkout@v4
with:
submodules: true
- run: |
mkdir -p ~/.ssh/
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
make
make deploy make deploy
env:
SSH_USERNAME: ${{ vars.SSH_USERNAME }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SSH_KNOWN_HOSTS: ${{ vars.SSH_KNOWN_HOSTS }}
DEPLOYMENT_HOST: ${{ vars.DEPLOYMENT_HOST }}
DEPLOYMENT_PATH: ${{ vars.DEPLOYMENT_PATH }}
APP_VERSION: ${{ env.GITEA_REF_NAME }}

View File

@@ -5,7 +5,6 @@ set -e
# FLOW # FLOW
### ###
# #
# if the private key variable is set, prepend "-i" to it
# if the username variable is set, append the at sign to it # if the username variable is set, append the at sign to it
# if either the deployment host or deployment path variables are not set, return an error # if either the deployment host or deployment path variables are not set, return an error
# tarball the built website and scp it to the deployment host # tarball the built website and scp it to the deployment host
@@ -13,9 +12,8 @@ set -e
# then remove everything in the data path, untar the tarball and reload the server # then remove everything in the data path, untar the tarball and reload the server
# finally remove the tarball, both from the remote host and locally (cleanup) # finally remove the tarball, both from the remote host and locally (cleanup)
# Check if the private key variable is set if [ -t 0 ]; then # Interactive: prompt user
if [ ! -z "${SSH_PRIVATE_KEY}" ]; then source .vars
SSH_PRIVATE_KEY="-i ${SSH_PRIVATE_KEY}"
fi fi
# Check if the username variable is set # Check if the username variable is set
@@ -29,14 +27,16 @@ if [ -z "${DEPLOYMENT_HOST}" ] || [ -z "${DEPLOYMENT_PATH}" ]; then
exit 1 exit 1
fi fi
# Compress the built website and scp it to the remote host
tar -czf httpdocs.tgz -C public . tar -czf httpdocs.tgz -C public .
scp -o StrictHostKeyChecking=no ${SSH_PRIVATE_KEY} httpdocs.tgz ${SSH_USERNAME}${DEPLOYMENT_HOST}:/tmp/httpdocs.tgz scp httpdocs.tgz ${SSH_USERNAME}${DEPLOYMENT_HOST}:/tmp/httpdocs.tgz
ssh -o StrictHostKeyChecking=no ${SSH_PRIVATE_KEY} ${SSH_USERNAME}${DEPLOYMENT_HOST} "DEPLOYMENT_PATH=$DEPLOYMENT_PATH bash" << 'EOF'
# SSH to the remote host, cd to the deployment path, and deploy the website (delete and overwrite everything)
ssh ${SSH_USERNAME}${DEPLOYMENT_HOST} "DEPLOYMENT_PATH=$DEPLOYMENT_PATH bash" << 'EOF'
cd ${DEPLOYMENT_PATH} cd ${DEPLOYMENT_PATH}
DATAPATH=$(cat .env | grep "NGINX_DATA" | sed "s/NGINX_DATA=//g") DATAPATH=$(cat .env | grep "NGINX_DATA" | sed "s/NGINX_DATA=//g")
rm -rf ${DATAPATH}/{*,.*} rm -rf ${DATAPATH}/{*,.*}
tar xf /tmp/httpdocs.tgz -C ${DATAPATH} tar xf /tmp/httpdocs.tgz -C ${DATAPATH}
docker compose restart
rm -f /tmp/httpdocs.tgz rm -f /tmp/httpdocs.tgz
EOF EOF
rm -f httpdocs.tgz rm -f httpdocs.tgz

View File

@@ -1,16 +1,15 @@
#!make #!make
include .vars
default: build default: build
prep: prep:
git submodule foreach --recursive bash -c "git checkout $$(git remote show origin | grep HEAD | sed 's/.*\: //'); git pull" git submodule foreach --recursive bash -c "git checkout \$$(git remote show origin | grep HEAD | sed 's/.*\: //'); git pull"
build: prep build: prep
./version.sh /usr/bin/env bash version.sh
deploy: deploy:
./deploy.sh /usr/bin/env bash deploy.sh
run: prep run: prep
hugo server hugo server

View File

@@ -3,6 +3,7 @@ set -e
# Check if version is already provided # Check if version is already provided
if [ -z "${APP_VERSION}" ]; then if [ -z "${APP_VERSION}" ]; then
if [ -t 0 ]; then # Interactive: prompt user
# Get version from user # Get version from user
read -p "Version [latest]: " VERSIONINPUT read -p "Version [latest]: " VERSIONINPUT
# If version was not provided, use the latest commit short hash as version # If version was not provided, use the latest commit short hash as version
@@ -11,6 +12,9 @@ if [ -z "${APP_VERSION}" ]; then
else else
APP_VERSION=${VERSIONINPUT} APP_VERSION=${VERSIONINPUT}
fi fi
else # Non-interactive (CI): default to "latest"
APP_VERSION="latest"
fi
fi fi
# Get project commit id and URL # Get project commit id and URL