Fix bug with scrollbars not rendering correctly. #87
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Ardent Website to Production | |
# 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`: | |
# | |
# cd {DEPLOY_DIR}/{SERVICE_NAME} | |
# pm2 start npm --name "{SERVICE_NAME}" -- run start | |
# | |
# DEPLOY_DIR should be an absolute path. | |
# SERVICE_NAME should match the name of the repository in GitHub. | |
on: | |
push: | |
branches: [ "main" ] | |
env: | |
SERVICE_NAME: ${{ github.event.repository.name }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Generate env.GITH_SHA_SHORT | |
run: echo "GIT_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV | |
- name: Deploy to Server | |
uses: easingthemes/ssh-deploy@main | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
ARGS: "-rlgoDzvc -i" | |
SOURCE: "./" | |
REMOTE_HOST: ${{ vars.DEPLOY_HOST }} | |
REMOTE_USER: ${{ vars.DEPLOY_USER }} | |
TARGET: "${{ vars.DEPLOY_DIR }}/${{ env.SERVICE_NAME }}-${{ env.GIT_SHA_SHORT}}" | |
EXCLUDE: ".git*, *.md, .next, LICENSE, node_modules/" | |
SCRIPT_BEFORE: | | |
rm -rf "${{ vars.DEPLOY_DIR }}/${{ env.SERVICE_NAME }}.tmp" | |
cp -R "${{ vars.DEPLOY_DIR }}/${{ env.SERVICE_NAME }}" "${{ vars.DEPLOY_DIR }}/${{ env.SERVICE_NAME }}-${{ env.GIT_SHA_SHORT}}" || : | |
SCRIPT_AFTER: | | |
cd "${{ vars.DEPLOY_DIR }}/${{ env.SERVICE_NAME }}-${{ env.GIT_SHA_SHORT}}" | |
npm install --omit=dev | |
npm run build | |
cd .. | |
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 }}" | |
rm -rf "${{ vars.DEPLOY_DIR }}/${{ env.SERVICE_NAME }}.tmp" | |
echo $RSYNC_STDOUT |