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

on:
push:
branches: [main]
pull_request:

jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- run: go vet ./...
- run: go test ./...
- name: Cross-compile
run: |
GOOS=windows GOARCH=amd64 go build -o /dev/null .
GOOS=linux GOARCH=arm64 go build -o /dev/null .
38 changes: 26 additions & 12 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name: Publish to PyPI
# Release: GitHub release (binaries + checksums), Homebrew cask, and PyPI wheels.
# Keep this filename: PyPI trusted publishing is bound to it.
name: Release

on:
push:
Expand All @@ -16,12 +18,12 @@ on:
- major

jobs:
publish:
release:
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
contents: write
id-token: write # PyPI trusted publishing
contents: write # GitHub release
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -48,19 +50,31 @@ jobs:
git tag "v${{ steps.version.outputs.next }}"
git push origin "v${{ steps.version.outputs.next }}"

- uses: actions/setup-go@v5
with:
go-version-file: go.mod

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

- name: GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Fine-grained PAT with contents:write on mihirgupta0900/homebrew-tap.
HOMEBREW_TAP_DEPLOY_KEY: ${{ secrets.HOMEBREW_TAP_DEPLOY_KEY }}

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Build
run: pip install hatch && hatch build
- name: Build PyPI wheels
run: python scripts/build_wheels.py

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event_name == 'workflow_dispatch' && format('v{0}', steps.version.outputs.next) || github.ref_name }}
generate_release_notes: true
files: dist/*
packages-dir: dist/wheels
88 changes: 88 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
version: 2
project_name: spawnpoint

before:
hooks:
- go mod tidy

builds:
# GitHub releases, Homebrew, install.sh and `sp update` self-updates.
- id: spawnpoint
main: .
binary: spawnpoint
env: [CGO_ENABLED=0]
goos: [darwin, linux, windows]
goarch: [amd64, arm64]
ignore:
- goos: windows
goarch: arm64
flags: [-trimpath]
ldflags:
- -s -w -X main.version={{ .Version }}

# Same binary, marked as installed from PyPI so `sp update` defers to
# pipx / uv / pip. Packed into wheels by scripts/build_wheels.py.
- id: pypi
main: .
binary: spawnpoint
env: [CGO_ENABLED=0]
goos: [darwin, linux, windows]
goarch: [amd64, arm64]
ignore:
- goos: windows
goarch: arm64
flags: [-trimpath]
ldflags:
- -s -w -X main.version={{ .Version }} -X github.com/mihirgupta0900/spawnpoint/internal/update.Channel=pypi

archives:
- id: spawnpoint
ids: [spawnpoint]
# No version in the name, so /releases/latest/download/<name> always works.
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
formats: [tar.gz]
format_overrides:
- goos: windows
formats: [zip]
files: [LICENSE, README.md]

checksum:
name_template: checksums.txt

homebrew_casks:
- name: spawnpoint
ids: [spawnpoint]
repository:
owner: mihirgupta0900
name: homebrew-tap
# Push with a deploy key scoped to the tap repo (secret HOMEBREW_TAP_DEPLOY_KEY)
# rather than a personal access token.
git:
url: git@github.com:mihirgupta0900/homebrew-tap.git
private_key: "{{ .Env.HOMEBREW_TAP_DEPLOY_KEY }}"
homepage: https://github.com/mihirgupta0900/spawnpoint
description: "One branch. Every repo. Ready to code. Multi-repo git worktree workspaces for you and your coding agents."
license: MIT
binaries: [spawnpoint]
custom_block: |
binary "spawnpoint", target: "sp"
hooks:
post:
# The binary isn't notarized; clear the quarantine flag so macOS runs it.
install: |
if OS.mac?
system_command "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "#{staged_path}/spawnpoint"]
end

# Local test builds: GORELEASER_CURRENT_TAG=v1.2.3 goreleaser release --snapshot --clean
snapshot:
version_template: "{{ .Version }}"

changelog:
use: github-native

release:
github:
owner: mihirgupta0900
name: spawnpoint
Loading
Loading