diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..163d5fc --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,22 @@ +name: Build + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.20' + + - name: Build + run: make diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3336f48 --- /dev/null +++ b/Makefile @@ -0,0 +1,33 @@ +.PHONY := all + +.SHELL := /bin/bash +.SHELLFLAGS := -ec + +MOD_NAME := oneoffhax +UTIL_DIRS := $(shell find . -maxdepth 1 -type d -not -path './.git' -not -path '.') +BIN_PATHS := $(shell find . -type f -not -path './.git' -executable) +BIN_DEST := /usr/local/bin/ + +all: init tidy build copy + +clean: + @rm go.mod + +init: + @go mod init ${MOD_NAME} + +tidy: + @go mod tidy + +build: + @for UTIL_DIR in ${UTIL_DIRS}; do \ + if [ -d $$UTIL_DIR ]; then \ + cd $$UTIL_DIR; \ + go build && echo "[+] $$UTIL_DIR built successfully."; \ + cd ..; \ + fi \ + done + +copy: + @sudo cp ${BIN_PATHS} ${BIN_DEST} +