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
28 changes: 13 additions & 15 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,30 +102,28 @@ jobs:
- name: Build Cross-Platform Binaries
run: |
if [ -z "${{ vars.PROJECT_NAME }}" ]; then
echo "ERROR: PROJECT_NAME GitHub variable is not set. Please set it in repository settings."
exit 1
PROJECT_NAME="enemeter-data-processing"
echo "Using default project name: $PROJECT_NAME"
else
PROJECT_NAME="${{ vars.PROJECT_NAME }}"
echo "Using project name from settings: $PROJECT_NAME"
fi

PROJECT_NAME="${{ vars.PROJECT_NAME }}"
echo "Using project name: $PROJECT_NAME"

go mod tidy
echo "Building CLI for version $VERSION"
mkdir -p dist

GOOS=linux GOARCH=amd64 go build -o dist/$PROJECT_NAME-linux -ldflags="-X '$PROJECT_NAME/commands.CurrentVersion=${VERSION}'" main.go || exit 1
GOOS=windows GOARCH=amd64 go build -o dist/$PROJECT_NAME.exe -ldflags="-X '$PROJECT_NAME/commands.CurrentVersion=${VERSION}'" main.go || exit 1
GOOS=darwin GOARCH=amd64 go build -o dist/$PROJECT_NAME-mac -ldflags="-X '$PROJECT_NAME/commands.CurrentVersion=${VERSION}'" main.go || exit 1

echo "Build completed. Contents of dist/:"
ls -lh dist/

make build-all VERSION=$VERSION

- name: Create GitHub Release
run: |
PROJECT_NAME="${{ vars.PROJECT_NAME }}"
if [ -z "$PROJECT_NAME" ]; then
PROJECT_NAME="enemeter-data-processing"
fi

gh release create "v${VERSION}" \
--title "Release v${VERSION}" \
--notes-file CHANGELOG.md \
--notes-file docs/CHANGELOG.md \
dist/$PROJECT_NAME-linux dist/$PROJECT_NAME.exe dist/$PROJECT_NAME-mac
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ steps.app-token.outputs.token }}
25 changes: 23 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
VERSION ?= 1.0.0
PROJECT_NAME = enemeter-data-processing

.PHONY: build build-all clean test

build:
go build -o dist/rubrion-cli ./cmd/rubrion-cli/main.go
mkdir -p dist
go build -o dist/$(PROJECT_NAME) ./cmd/$(PROJECT_NAME)

build-all:
mkdir -p dist
@echo "Building for Linux..."
GOOS=linux GOARCH=amd64 go build -o dist/$(PROJECT_NAME)-linux -ldflags="-X '$(PROJECT_NAME)/internal/commands.CurrentVersion=$(VERSION)'" ./cmd/$(PROJECT_NAME)
@echo "Building for Windows..."
GOOS=windows GOARCH=amd64 go build -o dist/$(PROJECT_NAME).exe -ldflags="-X '$(PROJECT_NAME)/internal/commands.CurrentVersion=$(VERSION)'" ./cmd/$(PROJECT_NAME)
@echo "Building for macOS..."
GOOS=darwin GOARCH=amd64 go build -o dist/$(PROJECT_NAME)-mac -ldflags="-X '$(PROJECT_NAME)/internal/commands.CurrentVersion=$(VERSION)'" ./cmd/$(PROJECT_NAME)
@echo "Build completed. Contents of dist/:"
@ls -lh dist/

clean:
rm -rf dist/

.PHONY: build
test:
go test -v ./...
Loading