Skip to content

feat: clean up version output format #1

feat: clean up version output format

feat: clean up version output format #1

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*.*.*' # Triggers on version tags like v0.2.0, v1.0.0, etc.
permissions:
contents: write
jobs:
release:
name: Build and 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.25'
- name: Get version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Build binaries
run: |
# Create dist directory
mkdir -p dist
# Define platforms
PLATFORMS=(
"linux/amd64"
"linux/arm64"
"darwin/amd64"
"darwin/arm64"
"windows/amd64"
"windows/arm64"
)
for PLATFORM in "${PLATFORMS[@]}"; do
GOOS=${PLATFORM%/*}
GOARCH=${PLATFORM#*/}
OUTPUT_NAME="sess-${GOOS}-${GOARCH}"
if [ "$GOOS" = "windows" ]; then
OUTPUT_NAME="${OUTPUT_NAME}.exe"
fi
echo "Building for $GOOS/$GOARCH..."
# versioninfo package automatically uses git tags and commits
# -s -w strips debug info for smaller binaries
GOOS=$GOOS GOARCH=$GOARCH go build \
-ldflags="-s -w" \
-o "dist/${OUTPUT_NAME}" \
./cmd/sess
# Create tarball/zip
cd dist
if [ "$GOOS" = "windows" ]; then
zip "sess-${GOOS}-${GOARCH}.zip" "${OUTPUT_NAME}"
rm "${OUTPUT_NAME}"
else
tar czf "sess-${GOOS}-${GOARCH}.tar.gz" "${OUTPUT_NAME}"
rm "${OUTPUT_NAME}"
fi
cd ..
done
- name: Generate checksums
run: |
cd dist
sha256sum * > checksums.txt
cat checksums.txt
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
dist/*.tar.gz
dist/*.zip
dist/checksums.txt
draft: false
prerelease: false
generate_release_notes: true
body: |
## Installation
### Linux (amd64)
```bash
curl -L https://github.com/${{ github.repository }}/releases/download/${{ steps.get_version.outputs.VERSION }}/sess-linux-amd64.tar.gz | tar xz
sudo mv sess-linux-amd64 /usr/local/bin/sess
```
### macOS (Apple Silicon)
```bash
curl -L https://github.com/${{ github.repository }}/releases/download/${{ steps.get_version.outputs.VERSION }}/sess-darwin-arm64.tar.gz | tar xz
sudo mv sess-darwin-arm64 /usr/local/bin/sess
```
### macOS (Intel)
```bash
curl -L https://github.com/${{ github.repository }}/releases/download/${{ steps.get_version.outputs.VERSION }}/sess-darwin-amd64.tar.gz | tar xz
sudo mv sess-darwin-amd64 /usr/local/bin/sess
```
### Windows (PowerShell)
```powershell
Invoke-WebRequest -Uri "https://github.com/${{ github.repository }}/releases/download/${{ steps.get_version.outputs.VERSION }}/sess-windows-amd64.zip" -OutFile "sess.zip"
Expand-Archive sess.zip -DestinationPath .
# Move sess-windows-amd64.exe to a directory in your PATH
```
## What's Changed
See the full changelog below.
## Verify Installation
```bash
sess --version
```
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}