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
48 changes: 48 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build

on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop

permissions:
contents: read

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
go-version: ['1.24']

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache-dependency-path: go.sum

- name: Build binaries
run: |
make build

- name: Test
run: go test ./...

- name: Upload artifacts
uses: actions/upload-artifact@v4
if: success()
with:
name: binaries-${{ matrix.os }}
path: bin/*
retention-days: 1

48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release

on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: 'Tag to release (e.g., v1.0.0)'
required: true
type: string

permissions:
contents: write
packages: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
cache-dependency-path: go.sum

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: 2.5.0
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload artifacts
uses: actions/upload-artifact@v4
if: failure()
with:
name: release-artifacts
path: dist/*

47 changes: 47 additions & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Snapshot

on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop

permissions:
contents: write
pull-requests: write

jobs:
snapshot:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
cache-dependency-path: go.sum

- name: Run GoReleaser snapshot
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: 2.5.0
args: release --snapshot --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload snapshot artifacts
uses: actions/upload-artifact@v4
with:
name: snapshot-artifacts
path: dist/*
retention-days: 1

16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
Brewfile.lock.json
data/

# Binaries
bin/m
bin/mlaunch
bin/mongo-cluster
bin/*.exe
bin/*.dll
bin/*.so
bin/*.dylib

# Legacy binary (if exists)
./bin/keyhole

mongo-cluster
mlaunch
m
cluster.json
168 changes: 168 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
# Goreleaser configuration for mongo-scaffold
# Builds and releases m and mlaunch binaries

project_name: mongo-scaffold

version: 2
# Build configuration
builds:
- id: m
main: ./cmd/m
binary: m
goos:
- linux
- darwin
goarch:
- amd64
- arm64
env:
- CGO_ENABLED=0
flags:
- -trimpath
ldflags:
- -s -w
- -X main.version={{.Version}}
- -X main.commit={{.Commit}}
- -X main.date={{.Date}}

- id: mlaunch
main: ./cmd/mlaunch
binary: mlaunch
goos:
- linux
- darwin
goarch:
- amd64
- arm64
env:
- CGO_ENABLED=0
flags:
- -trimpath
ldflags:
- -s -w
- -X main.version={{.Version}}
- -X main.commit={{.Commit}}
- -X main.date={{.Date}}

- id: mongo-cluster
main: ./cmd/mongo-cluster
binary: mongo-cluster
goos:
- linux
- darwin
goarch:
- amd64
- arm64
env:
- CGO_ENABLED=0
flags:
- -trimpath
ldflags:
- -s -w
- -X main.version={{.Version}}
- -X main.commit={{.Commit}}
- -X main.date={{.Date}}

# Archive configuration
archives:
- id: default
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
files:
- README.md
- LICENSE*
- CHANGELOG*
builds:
- m
- mlaunch
- mongo-cluster

# Checksums
checksum:
name_template: "{{ .ProjectName }}_{{ .Version }}_checksums.txt"
algorithm: sha256

# Snapshots
# Note: snapshot.name_template is deprecated in GoReleaser 2.5.0
# Removed to avoid deprecation warnings
snapshot: {}

# Changelog
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"

# Homebrew configuration
# Note: GoReleaser 2.5.0 uses 'brews' field for Homebrew formulas
brews:
- name: mongo-scaffold
homepage: "https://github.com/zph/mongo-scaffold"
description: "MongoDB version manager and cluster launcher"
license: "MIT"
# Install all binaries manually since 'binaries' field is not supported in 2.5.0
install: |
bin.install "m"
bin.install "mlaunch"
bin.install "mongo-cluster"
test: |
system "#{bin}/m", "--version"
system "#{bin}/mlaunch", "--help"
system "#{bin}/mongo-cluster", "--help"

# GitHub release configuration
release:
github:
owner: zph
name: mongo-scaffold
# Draft releases
draft: false
# Prerelease for tags with -alpha, -beta, -rc
mode: replace
header: |
## {{ .Tag }}

{{ if .PreviousTag }}
**Full Changelog**: https://github.com/zph/mongo-scaffold/compare/{{ .PreviousTag }}...{{ .Tag }}
{{ end }}

# Docker (optional - can be removed if not needed)
# dockers:
# - goos: linux
# goarch: amd64
# image_templates:
# - "ghcr.io/zph/mongo-scaffold:{{ .Tag }}"
# - "ghcr.io/zph/mongo-scaffold:latest"
# dockerfile: Dockerfile

# NFPM (for .deb and .rpm packages - optional)
# nfpms:
# - id: default
# package_name: mongo-scaffold
# file_name_template: "{{ .ConventionalFileName }}"
# maintainer: "zph <zph@example.com>"
# description: "MongoDB version manager and cluster launcher"
# license: "MIT"
# formats:
# - deb
# - rpm
# dependencies:
# - mongodb-community
# contents:
# - src: "{{ .ArtifactPath }}"
# dst: "/usr/local/bin/{{ .Binary }}"
# file_info:
# mode: 0755

# Before hook (optional)
# before:
# hooks:
# - go mod download
# - go generate ./...

# After hook (optional)
# after:
# hooks:
# - echo "Release {{ .Tag }} completed!"

1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.10
Loading
Loading