Compare commits

...

8 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
4 changed files with 17 additions and 13 deletions

View File

@@ -38,4 +38,4 @@ jobs:
SSH_KNOWN_HOSTS: ${{ vars.SSH_KNOWN_HOSTS }}
DEPLOYMENT_HOST: ${{ vars.DEPLOYMENT_HOST }}
DEPLOYMENT_PATH: ${{ vars.DEPLOYMENT_PATH }}
APP_VERSION: ${{ vars.GITHUB_REF_NAME }}
APP_VERSION: ${{ env.GITEA_REF_NAME }}

View File

@@ -12,6 +12,10 @@ set -e
# 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)
if [ -t 0 ]; then # Interactive: prompt user
source .vars
fi
# Check if the username variable is set
if [ ! -z "${SSH_USERNAME}" ]; then
SSH_USERNAME="${SSH_USERNAME}@"
@@ -25,10 +29,10 @@ fi
# Compress the built website and scp it to the remote host
tar -czf httpdocs.tgz -C public .
scp ${SSH_PRIVATE_KEY} httpdocs.tgz ${SSH_USERNAME}${DEPLOYMENT_HOST}:/tmp/httpdocs.tgz
scp httpdocs.tgz ${SSH_USERNAME}${DEPLOYMENT_HOST}:/tmp/httpdocs.tgz
# SSH to the remote host, cd to the deployment path, and deploy the website (delete and overwrite everything)
ssh ${SSH_PRIVATE_KEY} ${SSH_USERNAME}${DEPLOYMENT_HOST} "DEPLOYMENT_PATH=$DEPLOYMENT_PATH bash" << 'EOF'
ssh ${SSH_USERNAME}${DEPLOYMENT_HOST} "DEPLOYMENT_PATH=$DEPLOYMENT_PATH bash" << 'EOF'
cd ${DEPLOYMENT_PATH}
DATAPATH=$(cat .env | grep "NGINX_DATA" | sed "s/NGINX_DATA=//g")
rm -rf ${DATAPATH}/{*,.*}

View File

@@ -1,5 +1,4 @@
#!make
include .vars
default: build

View File

@@ -3,22 +3,23 @@ set -e
# Check if version is already provided
if [ -z "${APP_VERSION}" ]; then
# Get version from user
read -p "Version [latest]: " VERSIONINPUT
# If version was not provided, use the latest commit short hash as version
if [ -z ${VERSIONINPUT} ]; then
if [ -t 0 ]; then # Interactive: prompt user
# Get version from user
read -p "Version [latest]: " VERSIONINPUT
# If version was not provided, use the latest commit short hash as version
if [ -z ${VERSIONINPUT} ]; then
APP_VERSION="latest"
else
APP_VERSION=${VERSIONINPUT}
fi
else # Non-interactive (CI): default to "latest"
APP_VERSION="latest"
else
APP_VERSION=${VERSIONINPUT}
fi
fi
echo "Version: ${APP_VERSION}" >&2
# Get project commit id and URL
COMMIT_ID=$(git log HEAD --oneline | awk '{print $1}' | head -n1)
COMMIT_URL="$(git remote get-url origin | sed 's/\.git$//g;s/:/\//;s/git@/https:\/\//')/commit/${COMMIT_ID}"
echo "Commit ID: ${COMMIT_ID}" >&2
echo "Commit URL: ${COMMIT_URL}" >&2
# Get the theme used and its commit id and URL
THEME=$(cat hugo.yaml | grep "theme:" | awk '{print $2}' | sed 's/"//g')