Try and build
All checks were successful
/ build (push) Successful in 37s

This commit is contained in:
Chris Cowley 2024-10-04 10:24:50 +02:00
parent 1553f9e7c6
commit 033b5e4fac
3 changed files with 16 additions and 2 deletions

View file

@ -6,5 +6,4 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: build
run: |
echo docker build -t code.lab.cowley.tech/${GITHUB_REPOSITORY}:$(git rev-parse --short HEAD)
run: scripts/deploy.sh

View file

@ -1,4 +1,5 @@
GITREF := $(shell git rev-parse --short HEAD)
BRANCH := $(shell git branch --show-current)
init:
podman run --rm -ti -v ${PWD}:/docs docker.io/squidfunk/mkdocs-material new .

14
scripts/deploy.sh Executable file
View file

@ -0,0 +1,14 @@
#!/usr/bin/env bash
REPO="code.lab.cowley.tech/homelab/homelab-docs"
VERSION="$(date +%s)"
BRANCH="$(git branch --show-current)"
GITREF="$(git rev-parse --short HEAD)"
if [ "$(git branch --show-current)" == "main" ]
then
docker build -t "${REPO}:${VERSION}-${BRANCH}-${GITREF}" .
docker tag "${REPO}:${VERSION}-${BRANCH}-${GITREF}" "${REPO}:latest"
docker push "${REPO}:${VERSION}-${BRANCH}-${GITREF}"
docker push "${REPO}:latest"
fi