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: 0 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ coverage.out
README.md
DEVELOPMENT.md
SUMMARY.md
DOCKERHUB_SETUP.md
DOCKERHUB_QUICKSTART.md
PROJECT_COMPLETE.md
LICENSE

Expand Down
89 changes: 0 additions & 89 deletions .github/workflows/docker-publish.yml

This file was deleted.

168 changes: 86 additions & 82 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,103 +1,107 @@
name: Release

on:
push:
tags:
- "v*.*.*"

permissions:
contents: write
workflow_dispatch:
inputs:
bump:
description: 'Version bump for the next dev cycle'
type: choice
default: minor
options:
- minor
- major

jobs:
create-release:
name: Create Release
release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write

steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
- uses: actions/setup-go@v5
with:
go-version: "1.25"
go-version-file: go.mod

- name: Run tests
run: go test -v ./...
run: go test -race ./...

- name: Build binaries
- name: Resolve release version
id: version
run: |
# Build for multiple platforms
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o s3dir-linux-amd64 ./cmd/s3dir
GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o s3dir-linux-arm64 ./cmd/s3dir
GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o s3dir-darwin-amd64 ./cmd/s3dir
GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o s3dir-darwin-arm64 ./cmd/s3dir
GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o s3dir-windows-amd64.exe ./cmd/s3dir

# Create archives
tar czf s3dir-linux-amd64.tar.gz s3dir-linux-amd64
tar czf s3dir-linux-arm64.tar.gz s3dir-linux-arm64
tar czf s3dir-darwin-amd64.tar.gz s3dir-darwin-amd64
tar czf s3dir-darwin-arm64.tar.gz s3dir-darwin-arm64
zip s3dir-windows-amd64.zip s3dir-windows-amd64.exe

# Generate checksums
sha256sum s3dir-*.tar.gz s3dir-*.zip > checksums.txt

- name: Generate release notes
id: release_notes
DEV_VERSION=$(cat VERSION)
PENDING_VERSION="${DEV_VERSION%-dev}"
MAJOR=$(echo $PENDING_VERSION | cut -d. -f1)
MINOR=$(echo $PENDING_VERSION | cut -d. -f2)
if [ "${{ inputs.bump }}" = "major" ]; then
RELEASE_VERSION="$((MAJOR + 1)).0.0"
NEXT_VERSION="$((MAJOR + 1)).1.0-dev"
else
RELEASE_VERSION="$MAJOR.$MINOR.0"
NEXT_VERSION="$MAJOR.$((MINOR + 1)).0-dev"
fi
echo "$RELEASE_VERSION" > VERSION
echo "release=$RELEASE_VERSION" >> $GITHUB_OUTPUT
echo "next=$NEXT_VERSION" >> $GITHUB_OUTPUT

- name: Tag release
run: |
VERSION=${GITHUB_REF#refs/tags/}
echo "version=$VERSION" >> $GITHUB_OUTPUT

cat > release_notes.md << 'EOF'
## S3Dir ${{ github.ref_name }}

### Installation

#### Docker
```bash
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/s3dir:${{ github.ref_name }}
```

#### Binary Download
Download the appropriate binary for your platform below.

#### From Source
```bash
git clone https://github.com/${{ github.repository }}
cd s3dir
git checkout ${{ github.ref_name }}
go build -o s3dir ./cmd/s3dir
```

### Quick Start
```bash
# Extract binary (Linux/macOS example)
tar xzf s3dir-linux-amd64.tar.gz

# Run
./s3dir-linux-amd64
```

### Changes
See commit history for detailed changes.
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add VERSION
git commit -m "chore: release v${{ steps.version.outputs.release }} [skip ci]"
git tag "v${{ steps.version.outputs.release }}"
git push
git push --tags

- name: Bump to next dev version
run: |
echo "${{ steps.version.outputs.next }}" > VERSION
git add VERSION
git commit -m "chore: bump version to ${{ steps.version.outputs.next }} [skip ci]"
git push

### Checksums
See `checksums.txt` for SHA256 checksums of all artifacts.
EOF
- name: Build binaries
run: |
mkdir -p dist
LDFLAGS="-s -w -X main.version=${{ steps.version.outputs.release }}"
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "$LDFLAGS" -o dist/s3dir-linux-amd64 ./cmd/s3dir
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "$LDFLAGS" -o dist/s3dir-linux-arm64 ./cmd/s3dir
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "$LDFLAGS" -o dist/s3dir-darwin-amd64 ./cmd/s3dir
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "$LDFLAGS" -o dist/s3dir-darwin-arm64 ./cmd/s3dir
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "$LDFLAGS" -o dist/s3dir-windows-amd64.exe ./cmd/s3dir

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Create GitHub Release
uses: softprops/action-gh-release@v1
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
files: |
s3dir-*.tar.gz
s3dir-*.zip
checksums.txt
body_path: release_notes.md
draft: false
prerelease: false
context: .
platforms: linux/amd64,linux/arm64
push: true
build-args: |
VERSION=${{ steps.version.outputs.release }}
tags: |
ghcr.io/stut/s3dir:v${{ steps.version.outputs.release }}
ghcr.io/stut/s3dir:latest

- name: Create release
run: |
gh release create "v${{ steps.version.outputs.release }}" \
--title "v${{ steps.version.outputs.release }}" \
--generate-notes \
dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15 changes: 13 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,19 @@ aws --endpoint-url=http://localhost:8000 s3 cp --debug large-file s3://bucket/

GitHub Actions workflows in `.github/workflows/`:
- `ci.yml` - Tests on Ubuntu/macOS with Go 1.24/1.25
- `docker-publish.yml` - Docker image builds
- `release.yml` - Release binaries for multiple platforms
- `release.yml` - Manually-dispatched release workflow

### Versioning and releases

The `VERSION` file holds the current version, `X.Y.Z-dev` during development.
The version is injected at build time via `-ldflags "-X main.version=..."`
(the Makefile and Dockerfile both do this; a plain `go build` shows "dev").

Releases are cut by running the Release workflow (workflow_dispatch) with a
`minor` or `major` bump. It strips the `-dev` suffix, commits and tags
`vX.Y.0`, bumps `VERSION` to the next `-dev` version, builds the platform
binaries and a multi-arch image pushed to `ghcr.io/stut/s3dir`, and creates a
GitHub release with generated notes. Do not tag releases by hand.

**Important:**
- All tests must pass with `-race` flag
Expand Down
79 changes: 0 additions & 79 deletions DOCKERHUB_QUICKSTART.md

This file was deleted.

Loading
Loading