You've already forked pedini.dev
Compare commits
10 Commits
2e333ce882
...
0.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 8a94fe0add | |||
| 2f2c60126c | |||
| 83728057ee | |||
| 4f16efe7ed | |||
| 289e06d6c3 | |||
| 94469a598b | |||
| 50cd2ae16f | |||
| 53795cf5cd | |||
| 4fa2be1351 | |||
| d1465de486 |
@@ -38,4 +38,4 @@ jobs:
|
|||||||
SSH_KNOWN_HOSTS: ${{ vars.SSH_KNOWN_HOSTS }}
|
SSH_KNOWN_HOSTS: ${{ vars.SSH_KNOWN_HOSTS }}
|
||||||
DEPLOYMENT_HOST: ${{ vars.DEPLOYMENT_HOST }}
|
DEPLOYMENT_HOST: ${{ vars.DEPLOYMENT_HOST }}
|
||||||
DEPLOYMENT_PATH: ${{ vars.DEPLOYMENT_PATH }}
|
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
|
# 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)
|
||||||
|
|
||||||
|
if [ -t 0 ]; then # Interactive: prompt user
|
||||||
|
source .vars
|
||||||
|
fi
|
||||||
|
|
||||||
# Check if the username variable is set
|
# Check if the username variable is set
|
||||||
if [ ! -z "${SSH_USERNAME}" ]; then
|
if [ ! -z "${SSH_USERNAME}" ]; then
|
||||||
SSH_USERNAME="${SSH_USERNAME}@"
|
SSH_USERNAME="${SSH_USERNAME}@"
|
||||||
@@ -25,10 +29,10 @@ fi
|
|||||||
|
|
||||||
# Compress the built website and scp it to the remote host
|
# Compress the built website and scp it to the remote host
|
||||||
tar -czf httpdocs.tgz -C public .
|
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 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}
|
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}/{*,.*}
|
||||||
|
|||||||
Submodule themes/hugo-coder updated: e9dfb36b97...cb13ec4671
19
version.sh
19
version.sh
@@ -3,22 +3,23 @@ set -e
|
|||||||
|
|
||||||
# Check if version is already provided
|
# Check if version is already provided
|
||||||
if [ -z "${APP_VERSION}" ]; then
|
if [ -z "${APP_VERSION}" ]; then
|
||||||
# Get version from user
|
if [ -t 0 ]; then # Interactive: prompt user
|
||||||
read -p "Version [latest]: " VERSIONINPUT
|
# Get version from user
|
||||||
# If version was not provided, use the latest commit short hash as version
|
read -p "Version [latest]: " VERSIONINPUT
|
||||||
if [ -z ${VERSIONINPUT} ]; then
|
# 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"
|
APP_VERSION="latest"
|
||||||
else
|
|
||||||
APP_VERSION=${VERSIONINPUT}
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo "Version: ${APP_VERSION}"
|
|
||||||
|
|
||||||
# Get project commit id and URL
|
# Get project commit id and URL
|
||||||
COMMIT_ID=$(git log HEAD --oneline | awk '{print $1}' | head -n1)
|
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}"
|
COMMIT_URL="$(git remote get-url origin | sed 's/\.git$//g;s/:/\//;s/git@/https:\/\//')/commit/${COMMIT_ID}"
|
||||||
echo "Commit ID: ${COMMIT_ID}"
|
|
||||||
echo "Commit URL: ${COMMIT_URL}"
|
|
||||||
|
|
||||||
# Get the theme used and its commit id and URL
|
# Get the theme used and its commit id and URL
|
||||||
THEME=$(cat hugo.yaml | grep "theme:" | awk '{print $2}' | sed 's/"//g')
|
THEME=$(cat hugo.yaml | grep "theme:" | awk '{print $2}' | sed 's/"//g')
|
||||||
|
|||||||
Reference in New Issue
Block a user