Skip to content

Commit

Permalink
Add draft workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ericthelemur committed Oct 26, 2024
1 parent 110e394 commit f40b55b
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/draft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Deploy to site

on:
push:
branches: [ draft ]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SITES_SSH_PRIVATE_KEY }}
name: id_ed25519
known_hosts: ${{ vars.SSH_KNOWN_HOSTS }}
config: ${{ vars.SSH_CONFIG }}
if_key_exists: fail
- name: Update Server
run: ssh sites "/srv/warwickspeedrun/source/draft.sh"
2 changes: 2 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ set -e

export SCRIPT_DIR=$(dirname "$(realpath $0)")
cd $SCRIPT_DIR && echo "Running in $SCRIPT_DIR"

git checkout master
if [ -z $NO_PULL ]; then
git fetch --all --prune
git reset --hard origin/master
Expand Down
17 changes: 17 additions & 0 deletions draft.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh
set -e

export SCRIPT_DIR=$(dirname "$(realpath $0)")
cd $SCRIPT_DIR && echo "Running in $SCRIPT_DIR"

git checkout draft
if [ -z $NO_PULL ]; then
git fetch --all --prune
git reset --hard origin/draft
git pull --recurse-submodules
fi

# Build main
./zola build --base-url https://draft.warwickspeed.run --output-dir ../draft/public --force

[[ -f /srv/restart-lighttpd.sh ]] && sudo /srv/restart-lighttpd.sh

0 comments on commit f40b55b

Please sign in to comment.