Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ git-semver
.testworkdir

dist/

/bin
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,19 @@ $ docker pull psanetra/git-semver

To build locally for testing, ensure you have `go` installed.

Run `make build` to generate a `git-semver` package at `/bin/git-semver`.

The make file also allows for input of filenames.

To manually build without the use of the make file:

1. `cd` to the `cli` folder of the repo.
2. Run `go build -o <output_file>` to build the package.
3. Once complete, copy the package to a location in your terminal's path.
4. Run `source ~/.bashrc` (or appropriate `.rc` file for your terminal) to include the new package.

Once the build is complete, follow these steps to ensure you can run the package:

1. Once complete, copy the package to a location in your terminal's path.
2. Run `source ~/.bashrc` (or appropriate `.rc` file for your terminal) to include the new package.

## Commands

Expand Down
25 changes: 25 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Makefile at repo root

BINARY_NAME ?= git-semver
BUILD_DIR := cli
BIN_DIR := bin

.PHONY: all build clean test

all: build

## Build the CLI into ./bin/
build:
@echo "Building $(BINARY_NAME) from $(BUILD_DIR)..."
@mkdir -p $(BIN_DIR)
@cd $(BUILD_DIR) && go build -o ../$(BIN_DIR)/$(BINARY_NAME)

## Run all Go tests
test:
@echo "Running tests..."
@go test ./...

## Remove build artifacts
clean:
@echo "Cleaning build artifacts..."
@rm -rf $(BIN_DIR)/