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
71 changes: 68 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,21 @@ jobs:
echo "CC=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
fi

- name: Get version from tag
id: version
run: |
# Get version from tag or use git describe
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
else
VERSION=$(git describe --tags --always 2>/dev/null || echo "dev")
fi
COMMIT=$(git rev-parse --short HEAD)
DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "commit=$COMMIT" >> $GITHUB_OUTPUT
echo "date=$DATE" >> $GITHUB_OUTPUT

- name: Build binary
env:
GOOS: ${{ matrix.goos }}
Expand All @@ -94,7 +109,9 @@ jobs:
if [ "${{ matrix.goos }}" = "windows" ]; then
BINARY_NAME="${BINARY_NAME}.exe"
fi
go build -ldflags="-s -w" -o "${BINARY_NAME}"

LDFLAGS="-s -w -X main.version=${{ steps.version.outputs.version }} -X main.commit=${{ steps.version.outputs.commit }} -X main.date=${{ steps.version.outputs.date }}"
go build -ldflags="$LDFLAGS" -o "${BINARY_NAME}"

if [[ "${{ matrix.os }}" == macos* ]]; then
shasum -a 256 "${BINARY_NAME}" > "${BINARY_NAME}.sha256"
Expand All @@ -103,7 +120,7 @@ jobs:
fi

- name: Upload artifacts
if: github.event_name != 'pull_request' # don't upload artifacts for PRs
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.goos }}-${{ matrix.goarch }}
Expand Down Expand Up @@ -174,6 +191,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Download all artifacts
uses: actions/download-artifact@v4
Expand All @@ -189,14 +208,60 @@ jobs:

- name: Generate release notes
run: |
echo "# Vertex Service Manager ${GITHUB_REF#refs/tags/}" > release-notes.md
# Get version from tag
VERSION=${GITHUB_REF#refs/tags/}

echo "# Vertex Service Manager $VERSION" > release-notes.md
echo "" >> release-notes.md

# Get commits since last tag
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
if [ -n "$PREVIOUS_TAG" ]; then
echo "## Changes since $PREVIOUS_TAG" >> release-notes.md
echo "" >> release-notes.md
git log ${PREVIOUS_TAG}..HEAD --pretty=format:"- %s (%h)" >> release-notes.md
echo "" >> release-notes.md
fi

echo "" >> release-notes.md
echo "## 🚀 Features" >> release-notes.md
echo "- Complete microservice management platform" >> release-notes.md
echo "- Embedded React web interface" >> release-notes.md
echo "- Cross-platform support" >> release-notes.md
echo "- Real-time monitoring and logs" >> release-notes.md
echo "- Profile-based service management" >> release-notes.md
echo "- Environment variable management" >> release-notes.md
echo "" >> release-notes.md
echo "## 📦 Installation" >> release-notes.md
echo "" >> release-notes.md
echo "### Download Binary" >> release-notes.md
echo "" >> release-notes.md
echo "Download the appropriate binary for your platform:" >> release-notes.md
echo "" >> release-notes.md
echo "- **Linux (amd64)**: \`vertex-linux-amd64\`" >> release-notes.md
echo "- **Linux (arm64)**: \`vertex-linux-arm64\`" >> release-notes.md
echo "- **macOS (Intel)**: \`vertex-darwin-amd64\`" >> release-notes.md
echo "- **macOS (Apple Silicon)**: \`vertex-darwin-arm64\`" >> release-notes.md
echo "- **Windows (amd64)**: \`vertex-windows-amd64.exe\`" >> release-notes.md
echo "" >> release-notes.md
echo "\`\`\`bash" >> release-notes.md
echo "# Make executable and install" >> release-notes.md
echo "chmod +x vertex-*" >> release-notes.md
echo "sudo mv vertex-* /usr/local/bin/vertex" >> release-notes.md
echo "" >> release-notes.md
echo "# Verify installation" >> release-notes.md
echo "vertex version" >> release-notes.md
echo "\`\`\`" >> release-notes.md
echo "" >> release-notes.md
echo "### Docker" >> release-notes.md
echo "" >> release-notes.md
echo "\`\`\`bash" >> release-notes.md
echo "docker pull \${{ secrets.DOCKERHUB_USERNAME }}/vertex:$VERSION" >> release-notes.md
echo "# or" >> release-notes.md
echo "docker pull \${{ secrets.DOCKERHUB_USERNAME }}/vertex:latest" >> release-notes.md
echo "\`\`\`" >> release-notes.md

cat release-notes.md

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ RUN CGO_ENABLED=1 go build -ldflags="-s -w" -o vertex
FROM alpine:latest

# Install runtime dependencies
RUN apk --no-cache add ca-certificates sqlite
# Use --no-scripts to avoid trigger issues in QEMU ARM64 builds
RUN apk --no-cache --no-scripts add ca-certificates sqlite && \
update-ca-certificates 2>/dev/null || true

WORKDIR /app

Expand Down
66 changes: 66 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
.PHONY: build build-release build-frontend version install clean clean-all help

# Version information
# Try to get version from git tag, fallback to dev
GIT_TAG := $(shell git describe --tags --exact-match 2>/dev/null)
ifneq ($(GIT_TAG),)
# If we're on a tag, use it (strip 'v' prefix if present)
VERSION ?= $(shell echo $(GIT_TAG) | sed 's/^v//')
else
# Otherwise, try to get the latest tag + commit count
GIT_DESCRIBE := $(shell git describe --tags --always 2>/dev/null)
ifneq ($(GIT_DESCRIBE),)
VERSION ?= $(GIT_DESCRIBE)
else
VERSION ?= dev
endif
endif

COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
DATE := $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")

# Build flags
LDFLAGS := -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(DATE)

help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Available targets:'
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-15s %s\n", $$1, $$2}' $(MAKEFILE_LIST)

build-frontend: ## Build the frontend web application
@echo "Building frontend..."
@cd web && yarn install --frozen-lockfile && yarn build
@echo "✓ Frontend built: web/dist/"

build: build-frontend ## Build vertex with version information (includes frontend)
@echo "Building Vertex $(VERSION) ($(COMMIT)) ..."
@go build -ldflags="$(LDFLAGS)" -o vertex .
@echo "✓ Build complete: ./vertex"

build-release: build-frontend ## Build release version (set VERSION=x.x.x)
@if [ "$(VERSION)" = "dev" ]; then \
echo "Error: VERSION must be set for release builds"; \
echo "Usage: make build-release VERSION=1.0.0"; \
exit 1; \
fi
@echo "Building Vertex $(VERSION) ($(COMMIT)) ..."
@go build -ldflags="$(LDFLAGS)" -o vertex .
@echo "✓ Release build complete: ./vertex"

version: build ## Build and show version information
@./vertex version

install: build ## Build and install vertex
@./vertex install

clean: ## Remove Go build artifacts
@rm -f vertex vertex-*
@echo "✓ Build artifacts removed"

clean-all: clean ## Remove all build artifacts (including frontend)
@rm -rf web/dist web/node_modules
@echo "✓ All build artifacts removed"

# Quick development build (alias)
dev: build ## Alias for build
144 changes: 144 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# Release Guide

## Quick Release Process

1. **Commit all changes**
```bash
git add .
git commit -m "feat: your changes"
```

2. **Create and push version tag**
```bash
git tag -a v1.0.0 -m "Release version 1.0.0"
git push origin v1.0.0
```

3. **Wait for GitHub Actions**
- Workflow automatically builds binaries for all platforms
- Creates GitHub Release with binaries and release notes
- Check: https://github.com/zechtz/vertex/actions

4. **Done!**
- Users can download from: https://github.com/zechtz/vertex/releases

## What Happens Automatically

When you push a tag (e.g., `v1.0.0`):

1. **GitHub Actions triggers** (`.github/workflows/release.yml`)
2. **Builds binaries** for:
- Linux (amd64, arm64)
- macOS (Intel, Apple Silicon)
- Windows (amd64)
3. **Generates SHA256 checksums**
4. **Creates release notes** from git commits
5. **Publishes GitHub Release** with all artifacts

## Local Testing

Test the build before tagging:

```bash
# Build locally with current git tag
make build
./vertex version

# Build with specific version (override)
make build VERSION=1.0.0-test
./vertex version
```

## Version Numbering

Follow [Semantic Versioning](https://semver.org/):

- `v1.0.0` - Major release (breaking changes)
- `v1.1.0` - Minor release (new features, backward compatible)
- `v1.1.1` - Patch release (bug fixes)
- `v1.0.0-beta.1` - Pre-release

## Example Workflow

```bash
# 1. Make changes
vim internal/services/manager.go

# 2. Test locally
make build
./vertex version

# 3. Commit
git add .
git commit -m "feat: add new service management feature"

# 4. Tag and push
git tag -a v1.2.0 -m "Release version 1.2.0 - Add service management"
git push origin main
git push origin v1.2.0

# 5. Monitor GitHub Actions
# Visit: https://github.com/zechtz/vertex/actions

# 6. Release is ready!
# Visit: https://github.com/zechtz/vertex/releases/latest
```

## Troubleshooting

### Build fails in GitHub Actions

- Check the Actions tab for detailed logs
- Common issues:
- Tests failing
- Dependencies not available
- Go version mismatch

### Version not detected

```bash
# Check git tags
git tag -l

# Check current version
git describe --tags

# If no tags exist, create one
git tag -a v0.1.0 -m "Initial release"
```

### Need to re-release

If you need to fix a release:

```bash
# Delete the tag locally and remotely
git tag -d v1.0.0
git push origin :refs/tags/v1.0.0

# Delete the GitHub Release (via web UI)
# Make your fixes, commit, and re-tag
git tag -a v1.0.0 -m "Release version 1.0.0"
git push origin v1.0.0
```

## Manual Release (Without CI/CD)

If you need to create a release manually:

```bash
# Build all platforms
./build.sh

# This creates:
# - vertex-linux-amd64
# - vertex-linux-arm64
# - vertex-darwin-amd64
# - vertex-darwin-arm64
# - vertex-windows-amd64.exe

# Create checksums
sha256sum vertex-* > checksums.txt

# Manually create GitHub Release and upload files
```
Loading