Add download, build, and optionally push script

This commit is contained in:
askiiart 2023-08-28 17:27:25 -05:00
parent 71caaca21c
commit 894e2bed22
No known key found for this signature in database
GPG key ID: 85505F3A2264FA01
2 changed files with 30 additions and 0 deletions

View file

@ -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`

24
download-build-push.sh Executable file
View file

@ -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}