From 894e2bed222b6da284f2867ec21312b62a3d3c26 Mon Sep 17 00:00:00 2001 From: askiiart Date: Mon, 28 Aug 2023 17:27:25 -0500 Subject: [PATCH] Add download, build, and optionally push script --- README.md | 6 ++++++ download-build-push.sh | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100755 download-build-push.sh diff --git a/README.md b/README.md index fe84abd..e4946c7 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,12 @@ services: ## Building +### Manually + 1. Download Dart Sass (linux-x64) from [here](https://github.com/sass/dart-sass/releases/latest), and extract it with `tar -xzf dart-sass-*.tar.gz` 2. Download Hugo from (linux-amd64) from [here](https://github.com/gohugoio/hugo/releases/latest) and extract it with `tar -xzf hugo_*_linux-amd64.tar.gz --one-top-level` 3. Run `docker build .` + +### Automatically + +1. Edit and run `./download-build-push.sh` diff --git a/download-build-push.sh b/download-build-push.sh new file mode 100755 index 0000000..cf6e9e6 --- /dev/null +++ b/download-build-push.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env sh +ORG=askiiart +NAME=hugo +PUSH=yes + +curl -s https://api.github.com/repos/sass/dart-sass/releases/latest | grep "browser_download_url.*dart-sass-.*-linux-x64.tar.gz" | cut -d : -f 2,3 | tr -d \" | wget -qi - +curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | grep "browser_download_url.*hugo_.*_linux-amd64.tar.gz" | head --lines 1 | cut -d : -f 2,3 | tr -d \" | wget -qi - + +tar -xzf dart-sass-*.tar.gz +tar -xzf hugo_*_linux-amd64.tar.gz --one-top-level + +VERSION=$(find . -name "hugo_*_linux-amd64" | sed 's/.*_\(.*\)_.*/\1/') +ID=$(docker build . -q) + +if PUSH=yes; then + echo hi + exit +fi + +docker tag ${ID} ${ORG}/${NAME}:latest +docker tag ${ID} ${ORG}/${NAME}:v${VERSION} +docker push ${ORG}/${NAME}:latest +docker push ${ORG}/${NAME}:v${VERSION} +