Skip to content

Commit

Permalink
Update deployment script
Browse files Browse the repository at this point in the history
  • Loading branch information
iaincollins committed Feb 11, 2024
1 parent b90aa26 commit 0cffba7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
26 changes: 20 additions & 6 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
name: Deploy Ardent Website to Production

# ABOUT
# This deployment script assumes the following are configured in GitHub actions:
#
# SSH_PRIVATE_KEY [secret]
# DEPLOY_HOST [variable]
# DEPLOY_USER [variable]
# DEPLOY_DIR [variable]
#
# It also assumes that Node.js is installed, that PM2 is installed globally
# (e.g. `npm i pm2 -g`) and that the service has been started with `pm2`:
# Note:
# * DEPLOY_DIR should be an absolute path.
# * SERVICE_NAME should match the name of the repository in GitHub.
#
# cd {DEPLOY_DIR}/{SERVICE_NAME}
# pm2 start npm --name "{SERVICE_NAME}" -- run start
# SETUP
#
# DEPLOY_DIR should be an absolute path.
# SERVICE_NAME should match the name of the repository in GitHub.
# This script assumes that Node.js is installed, that "pm2" is installed
# globally and that pm2 has been used to already run the program once, as the
# same user the deploy script will run as (which should not be root).
#
# How to install pm2 and configure pm2 to run at startup:
# npm i pm2 -g
# pm2 startup
#
# An example of how to start this program using pm2:
# export DEPLOY_DIR=/opt/ardent
# export SERVICE_NAME=ardent-www
# cd $DEPLOY_DIR}/SERVICE_NAME
# pm2 start npm --name "$SERVICE_NAME" -- run start
# pm2 save

on:
push:
Expand Down Expand Up @@ -51,5 +64,6 @@ jobs:
mv "${{ vars.DEPLOY_DIR }}/${{ env.SERVICE_NAME }}" "${{ vars.DEPLOY_DIR }}/${{ env.SERVICE_NAME }}.tmp" || :
mv "${{ vars.DEPLOY_DIR }}/${{ env.SERVICE_NAME }}-${{ env.GIT_SHA_SHORT}}" "${{ vars.DEPLOY_DIR }}/${{ env.SERVICE_NAME }}"
pm2 restart "${{ env.SERVICE_NAME }}"
pm2 save
rm -rf "${{ vars.DEPLOY_DIR }}/${{ env.SERVICE_NAME }}.tmp"
echo $RSYNC_STDOUT
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ardent-www",
"version": "0.38.7",
"version": "0.38.8",
"description": "Ardent Industry",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 0cffba7

Please sign in to comment.