diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml index 9960286..d81ad6d 100644 --- a/.forgejo/workflows/build.yaml +++ b/.forgejo/workflows/build.yaml @@ -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 diff --git a/Makefile b/Makefile index e9bcacd..5ac4148 100644 --- a/Makefile +++ b/Makefile @@ -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 . diff --git a/scripts/deploy.sh b/scripts/deploy.sh new file mode 100755 index 0000000..f7a92c6 --- /dev/null +++ b/scripts/deploy.sh @@ -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