Last active
November 13, 2019 17:03
-
-
Save myobie/df46db4681856a9ea27c3cb4cdcf9521 to your computer and use it in GitHub Desktop.
Zeit Now + Hugo current best setup
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
🎉 |
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
#!/bin/bash | |
if [[ "$OSTYPE" == "darwin"* ]]; then | |
exec hugo | |
else | |
vendor="$(cd "$(dirname $0)/.." && pwd)/vendor" | |
commit_ref="${NOW_GITHUB_COMMIT_REF:-master}" | |
if [[ "$commit_ref" == "master" ]]; then | |
exec $vendor/hugo | |
else | |
exec $vendor/hugo -b "https://examplecom-git-${commit_ref}.example.now.sh" | |
fi | |
fi |
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
#!/bin/bash | |
version="0.59.1" | |
url="https://github.com/gohugoio/hugo/releases/download/v${version}/hugo_extended_${version}_Linux-64bit.tar.gz" | |
cd vendor && | |
curl -s -L -O "$url" && | |
tar -xzf "hugo_extended_${version}_Linux-64bit.tar.gz" |
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
#!/usr/bin/env ruby | |
MINIMUM_HUGO_VERSION = Gem::Version.new("0.59.1") | |
$force = ARGV.include?("-f") | |
version = | |
`brew ls --versions hugo`. | |
chomp. | |
split(" "). | |
tap { |arr| arr.delete("hugo") }. | |
map { |s| Gem::Version.new(s) }. | |
max | |
if version.nil? | |
system "brew install hugo" | |
elsif version < MINIMUM_HUGO_VERSION | |
system "brew upgrade hugo" | |
elsif $force | |
system "brew upgrade hugo" | |
end | |
`which forward` | |
system "gem install forward" if $force or not $?.success? |
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": "example.com", | |
"version": "1.0.0", | |
"description": "", | |
"scripts": { | |
"install": "bin/download", | |
"build": "bin/build", | |
"dev": "hugo serve", | |
"forward": "forward 0.0.0.0:1313 example", | |
"clear": "rm -rf public/*", | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"repository": { | |
"type": "git", | |
"url": "git+https://github.com/example/example.com.git" | |
}, | |
"author": "Nathan Herald <me@nathanherald.com>", | |
"license": "MIT", | |
"bugs": { | |
"url": "https://github.com/example/example.com/issues" | |
}, | |
"homepage": "https://github.com/example/example.com#readme" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
❤️