Merge pull request #125 from softplus/patch-1 #51
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: website | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ main ] | |
paths: | |
- site/** | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get short commit hash | |
run: | | |
short_hash=$(git rev-parse --short HEAD) | |
echo "GIT_COMMIT_SHA_SHORT=$short_hash" >> $GITHUB_ENV | |
- name: Setup SSH key | |
env: | |
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | |
run: | | |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null | |
ssh-add - <<< "${{ secrets.SSH_SITE_KEY }}" | |
- name: Install Hugo | |
uses: peaceiris/actions-hugo@v2 | |
with: | |
hugo-version: 'latest' | |
extended: true | |
- name: Add theme | |
run: | | |
git submodule init | |
git submodule update | |
- name: Build website | |
run: hugo | |
working-directory: site/ | |
- name: Copy files to webserver | |
env: | |
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | |
run: scp -r -o "StrictHostKeyChecking no" ./* roadcaptain@roadcaptain.nl:/var/www/roadcaptain.nl | |
working-directory: site/public/ |