website/.github/workflows/deploy.yml
2024-09-06 18:11:04 -07:00

77 lines
1.7 KiB
YAML

name: Build and Deploy Hugo Website
on:
workflow_dispatch:
push:
branches: main
schedule:
- cron: "21 14 * * *"
#concurrency:
# cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
build_and_publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: Git submodule update
run: |
git pull --recurse-submodules
git submodule update --remote --recursive
- name: Pull down Git LFS files
run: |
git lfs fetch
git lfs checkout
- name: Setup Hugo
env:
HUGO_VERSION: 0.105.0
run: |
curl -L "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz" --output hugo.tar.gz
tar -xvzf hugo.tar.gz
sudo mv hugo /usr/local/bin
- name: Install Rust
run: |
sudo apt update
sudo apt install -y rustc cargo
- name: Build Website-Toots
run: |
cd content/toots/.scripts
cargo build --release
- name: Pre-build script
run: |
./build.sh
- name: Build Hugo Website
id: build
run: |
hugo
- name: Install SSH Key
run: |
install -m 600 -D /dev/null ~/.ssh/id_rsa
echo "${{ secrets.BUILD_SSH_KEY }}" > ~/.ssh/id_rsa
echo "${{ secrets.HOST_KEY }}" > ~/.ssh/known_hosts
echo "Host brandonrozek.com
Hostname brandonrozek.com
user build
IdentityFile ~/.ssh/id_rsa" > ~/.ssh/config
- name: Deploy
run: ./deploy.sh