From b056f1614a5e9a8d93b1c74476c6f10aca08dab1 Mon Sep 17 00:00:00 2001 From: pranavpudasaini Date: Wed, 16 Aug 2023 08:53:12 +0545 Subject: [PATCH 1/3] feat: automate builds --- Makefile | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..67cb477 --- /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: clean 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} + From 904877dd511353ba3598b4e36128a974c462385e Mon Sep 17 00:00:00 2001 From: Pranav <23631617+pranavpudasaini@users.noreply.github.com> Date: Sun, 3 Sep 2023 11:52:01 +0545 Subject: [PATCH 2/3] feat: build go --- .github/workflows/go.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/go.yml 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 From 029b1b5d1a6a22747a992a0e4475f41a0702193f Mon Sep 17 00:00:00 2001 From: Pranav <23631617+pranavpudasaini@users.noreply.github.com> Date: Sun, 3 Sep 2023 11:53:30 +0545 Subject: [PATCH 3/3] fix: remove auto clean --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 67cb477..3336f48 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ 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: clean init tidy build copy +all: init tidy build copy clean: @rm go.mod