From 59456e202e5feb958adcf1f694cf774b4aaabdba Mon Sep 17 00:00:00 2001 From: Phillip Tarrant Date: Thu, 4 Dec 2025 00:42:06 -0600 Subject: [PATCH] testing actions --- .gitea/workflows/docker-build.yaml | 1 + build_push_image.sh | 108 ----------------------------- 2 files changed, 1 insertion(+), 108 deletions(-) delete mode 100755 build_push_image.sh diff --git a/.gitea/workflows/docker-build.yaml b/.gitea/workflows/docker-build.yaml index 967b0ee..d44132f 100644 --- a/.gitea/workflows/docker-build.yaml +++ b/.gitea/workflows/docker-build.yaml @@ -9,6 +9,7 @@ jobs: build: runs-on: ubuntu-latest + # required to ensure we have node and all the build requirements for gitea actions container: docker.io/catthehacker/ubuntu:act-latest steps: diff --git a/build_push_image.sh b/build_push_image.sh deleted file mode 100755 index 4478885..0000000 --- a/build_push_image.sh +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -######################################## -# Config (edit these) -######################################## -REGISTRY="git.sneakygeek.net" -NAMESPACE="sneakygeek" -IMAGE_NAME="sneakymon" - -# A helpful pointer/reference for your repo URL. Not used by docker commands, -# but kept for clarity and future automation if you want to clone/build elsewhere. -GIT_REPO_URL="https://git.sneakygeek.net/sneakygeek/sneakymon.git" - -# If you prefer to override the tag manually sometimes: -# export DOCKER_TAG=my-custom-tag -######################################## - -# Colors -BOLD='\033[1m'; DIM='\033[2m'; GREEN='\033[32m'; YELLOW='\033[33m'; RED='\033[31m'; NC='\033[0m' - -# Helpers -confirm() { - # Usage: confirm "Question?" default_yes|default_no - local prompt response default - if [[ "${2:-default_no}" == "default_yes" ]]; then - prompt=" [Y/n] " - default="y" - else - prompt=" [y/N] " - default="n" - fi - read -r -p "$1$prompt" response || true - response="${response:-$default}" - [[ "$response" =~ ^[Yy]$ ]] -} - -docker_tag_sanitize() { - # Docker tag must be <=128 chars, allowed: [A-Za-z0-9_.-], usually lowercase for sanity - local raw="$1" - local lower="${raw,,}" - local safe - safe="$(printf '%s' "$lower" | tr -c 'a-z0-9_.-' '-')" - printf '%.128s' "$safe" -} - -detect_git_tag() { - if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then - # Branch name or fallback to describe if detached - local ref - ref="$(git rev-parse --abbrev-ref HEAD 2>/dev/null || true)" - if [[ "$ref" == "HEAD" || -z "$ref" ]]; then - # detached HEAD → use nearest tag or short commit - ref="$(git describe --tags --always --dirty 2>/dev/null || git rev-parse --short HEAD 2>/dev/null || echo 'detached')" - fi - docker_tag_sanitize "$ref" - else - # Not a git repo → default to "latest" unless DOCKER_TAG is set - echo "latest" - fi -} - -main() { - local image_repo="${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}" - local tag latest_tag push_it push_latest - - # Determine tag - if [[ -n "${DOCKER_TAG:-}" ]]; then - tag="$(docker_tag_sanitize "$DOCKER_TAG")" - else - tag="$(detect_git_tag)" - fi - - echo -e "${BOLD}Image:${NC} ${image_repo}" - echo -e "${BOLD}Tag: ${NC} ${GREEN}${tag}${NC}" - echo -e "${DIM}(git: $(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo 'n/a'), repo: ${GIT_REPO_URL})${NC}" - - # Build - echo -e "\n${BOLD}==> Building ${image_repo}:${tag}${NC}" - docker build -t "${image_repo}:${tag}" . - - # Ask about :latest - if confirm "Also tag as :latest?" default_no; then - latest_tag="latest" - echo -e "${BOLD}Tagging:${NC} ${image_repo}:${latest_tag}" - docker tag "${image_repo}:${tag}" "${image_repo}:${latest_tag}" - push_latest="yes" - else - push_latest="no" - fi - - # Ask about pushing - if confirm "Push the built image(s) now?" default_yes; then - echo -e "\n${BOLD}==> Pushing ${image_repo}:${tag}${NC}" - docker push "${image_repo}:${tag}" - if [[ "$push_latest" == "yes" ]]; then - echo -e "${BOLD}==> Pushing ${image_repo}:latest${NC}" - docker push "${image_repo}:latest" - fi - echo -e "${GREEN}Done.${NC}" - else - echo -e "${YELLOW}Skipping push. Local images created:${NC}" - echo " - ${image_repo}:${tag}" - [[ "$push_latest" == "yes" ]] && echo " - ${image_repo}:latest" - fi -} - -main "$@"