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

on:
push:
tags:
- 'v*'

permissions:
contents: write

jobs:
build-binaries:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- goos: linux
goarch: amd64
ext: ''
asset: stern-ui-linux-amd64
- goos: linux
goarch: arm64
ext: ''
asset: stern-ui-linux-arm64
- goos: darwin
goarch: arm64
ext: ''
asset: stern-ui-darwin-arm64
- goos: windows
goarch: amd64
ext: .exe
asset: stern-ui-windows-amd64.exe
- goos: windows
goarch: arm64
ext: .exe
asset: stern-ui-windows-arm64.exe
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up tools (Go, Node) via mise
uses: jdx/mise-action@v4

- name: Install frontend dependencies
run: npm install
working-directory: frontend

- name: Build frontend (produces embedded dist/)
run: npm run build
working-directory: frontend

- name: Build binary
run: go build -trimpath -ldflags "-s -w" -o "dist/${{ matrix.asset }}" main.go
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0

- name: Upload release artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset }}
path: dist/${{ matrix.asset }}
if-no-files-found: error

upload-release:
needs: build-binaries
runs-on: ubuntu-latest
steps:
- name: Download all binaries
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true

- name: Wait for GitHub release to be created
env:
GH_TOKEN: ${{ github.token }}
run: |
for i in $(seq 1 60); do
if gh release view "${{ github.ref_name }}" >/dev/null 2>&1; then
echo "Release ${{ github.ref_name }} found"
exit 0
fi
echo "Waiting for release ${{ github.ref_name }}... ($i)"
sleep 10
done
echo "Release ${{ github.ref_name }} not created after 10 minutes" >&2
exit 1

- name: Upload binaries to release
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload "${{ github.ref_name }}" dist/* --clobber
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- GitHub Actions CI workflow that compiles and runs all tests (pre-commit, golangci-lint, backend and frontend tests) on push and pull requests
- GitHub Actions CI workflow that compiles and runs all tests (pre-commit, golangci-lint, backend and frontend tests) on pull requests
- GitHub Actions release workflow that builds cross-platform binaries (linux amd64/arm64, macos arm64, windows amd64/arm64) and attaches them to the GitHub release on version tags
- Renovate configuration for automated dependency update PRs (frontend, Go, and Docker)

### Changed
Expand All @@ -18,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Centralized developer tooling versions (Go, Node, golangci-lint) in a single `mise.toml`, consumed by CI via `jdx/mise-action` and auto-updated by Renovate
- Docker frontend build stage now uses Node 24 instead of the deprecated Node 20 base image
- CI now provisions all tool runtimes through mise instead of separate setup-node/setup-go/golangci-lint actions
- CI workflow now runs on pull requests only (previously also ran on pushes to main/develop)

### Fixed

Expand Down
35 changes: 25 additions & 10 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,21 @@ If you prefer to run the script directly without Task:

### How It Works

The script automatically:
When bumping a version, the script automatically:
1. Checks prerequisites (git, gh CLI, clean working directory)
2. Parses the current version from CHANGELOG.md
3. Determines version to release (bump or use current)
4. Updates CHANGELOG.md with new Unreleased section (if bumping)
5. Creates and pushes git tag
6. Commits changelog changes
7. Creates GitHub release with extracted release notes
4. Creates a `release/vX.Y.Z` branch from the default branch
5. Updates CHANGELOG.md with new Unreleased section
6. Commits the changelog (retrying if pre-commit hooks modify files)
7. Pushes the release branch and opens a pull request into `main`
8. Waits for the CI checks to pass
9. Merges the pull request
10. Checks out `main` and pulls the merged changes
11. Creates and pushes the `vX.Y.Z` tag, then creates the GitHub release
(a release workflow builds and attaches the platform binaries)

When using `--current`, no changelog changes are needed, so it tags `main` directly without a branch/PR.

### Example Output

Expand Down Expand Up @@ -124,12 +131,20 @@ Proceed with release 0.2.0? (y/N) y

ℹ Starting release process...

ℹ Creating release branch release/v0.2.0 from main...
ℹ Updating CHANGELOG.md...
✓ CHANGELOG.md updated
ℹ Creating git tag v0.2.0...
✓ Commit succeeded
ℹ Pushing release branch release/v0.2.0...
ℹ Creating pull request...
ℹ Pull request created: https://github.com/Esysc/stern-ui/pull/N
ℹ Waiting for CI checks on https://github.com/Esysc/stern-ui/pull/N...
✓ All CI checks passed
ℹ Merging pull request...
ℹ Switching back to main and pulling merged changes...
✓ Tag v0.2.0 created
ℹ Pushing changes to remote...
✓ Changes and tag pushed to remote
ℹ Pushing tag v0.2.0...
✓ Tag v0.2.0 pushed
✓ GitHub release created: v0.2.0

✓ Release 0.2.0 completed!
Expand All @@ -144,12 +159,12 @@ Proceed with release 0.2.0? (y/N) y
git commit -m "feat: add new feature"
```

3. Run the release:
3. Run the release (from the default branch, `main`):
```bash
task release -- minor
```

The script will automatically create an [Unreleased] section in the CHANGELOG for the next release.
The script will create a `release/vX.Y.Z` branch, open a PR, wait for CI to pass, merge it, and then tag `main`. It also creates a fresh `[Unreleased]` section in the CHANGELOG for the next release.

### Troubleshooting

Expand Down
Loading
Loading