You've already forked pedini.dev
Compare commits
8 Commits
4fa2be1351
...
0.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 8a94fe0add | |||
| 2f2c60126c | |||
| 83728057ee | |||
| 4f16efe7ed | |||
| 289e06d6c3 | |||
| 94469a598b | |||
| 50cd2ae16f | |||
| 53795cf5cd |
@@ -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 }}
|
||||
|
||||
@@ -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}/{*,.*}
|
||||
|
||||
19
version.sh
19
version.sh
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user