Add Stork to GitHub Actions

main
Elnu 2 years ago
parent a17ec1d727
commit a52689492d

@ -8,7 +8,7 @@ on:
jobs:
deploy:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
@ -20,12 +20,15 @@ jobs:
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.100.2'
hugo-version: 'latest'
# extended: true
- name: Build
run: hugo --minify
- name: Stork Index
run: ./stork_index.sh
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/main' }}

@ -0,0 +1,34 @@
#!/usr/bin/env bash
main() {
declare hugo_publish_dir=public
declare stork_config_file=stork.config.json # generated by hugo
declare stork_index_file=home.st # generated by stork (json suffix triggers gzip/br compression)
declare stork_arch=stork-ubuntu-20-04
declare stork_releases=https://files.stork-search.net/releases
declare stork_version=1.5.0
declare stork_exec=${stork_arch}-${stork_version}
declare stork_url=${stork_releases}/v${stork_version}/${stork_arch}
# Install Stork if it's not already installed.
if [[ ! -f "${stork_exec}" ]]; then
echo -e "\nInstalling Stork...\n"
wget --no-verbose "${stork_url}" ||
{ echo "Error: unable to wget ${stork_url}"; exit 1; }
mv "${stork_arch}" "${stork_exec}" ||
{ echo "Error: unable to mv ${stork_arch} ${stork_exec}"; exit 1; }
chmod +x "${stork_exec}" ||
{ echo "Error: unable to chmod ${stork_exec}"; exit 1; }
fi
# Build the Stork index.
echo -e "\nBuilding Stork index...\n"
./${stork_exec} build --input "${hugo_publish_dir}/${stork_config_file}" --output "${hugo_publish_dir}/${stork_index_file}" ||
{ echo "Error: unable to run stork"; exit 1; }
}
set -euo pipefail
main "$@"
Loading…
Cancel
Save