Skip to content

Release

Release #15

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
description: "Release version (e.g., v1.0.0)"
required: true
type: string
draft:
description: "Create as draft release"
required: false
type: boolean
default: false
prerelease:
description: "Mark as pre-release"
required: false
type: boolean
default: false
permissions:
contents: write
jobs:
build:
name: Build Binaries
runs-on: ubuntu-latest
strategy:
matrix:
include:
- goos: darwin
goarch: amd64
- goos: darwin
goarch: arm64
- goos: linux
goarch: amd64
- goos: linux
goarch: arm64
- goos: windows
goarch: amd64
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Cache X11 dependencies
if: matrix.goos == 'linux'
uses: actions/cache@v3
with:
path: /var/cache/apt
key: ${{ runner.os }}-x11-deps-${{ hashFiles('go.mod') }}
restore-keys: |
${{ runner.os }}-x11-deps-
- name: Install X11 dependencies
if: matrix.goos == 'linux'
run: |
sudo apt update
sudo apt install -y libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev
- name: Build binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
VERSION: ${{ github.event.inputs.version }}
run: |
OUTPUT_NAME="initiat"
if [ "$GOOS" = "windows" ]; then
OUTPUT_NAME="initiat.exe"
fi
go build \
-ldflags "-X github.com/InitiatDev/initiat-cli/cmd.version=${VERSION} -s -w" \
-o "${OUTPUT_NAME}" \
.
ARCHIVE_NAME="initiat-${GOOS}-${GOARCH}"
if [ "$GOOS" = "windows" ]; then
zip "${ARCHIVE_NAME}.zip" "${OUTPUT_NAME}"
else
tar -czf "${ARCHIVE_NAME}.tar.gz" "${OUTPUT_NAME}"
fi
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.goos }}-${{ matrix.goarch }}
path: |
*.tar.gz
*.zip
retention-days: 1
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
pattern: binaries-*
merge-multiple: true
- name: Generate checksums
run: |
sha256sum initiat-* > checksums.txt
cat checksums.txt
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.inputs.version }}
name: Release ${{ github.event.inputs.version }}
draft: ${{ github.event.inputs.draft }}
prerelease: ${{ github.event.inputs.prerelease }}
files: |
*.tar.gz
*.zip
checksums.txt
body: |
## What's New in ${{ github.event.inputs.version }}
See [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md) for detailed changes.
## Installation
### macOS
```bash
# Intel
curl -L https://github.com/${{ github.repository }}/releases/download/${{ github.event.inputs.version }}/initiat-darwin-amd64.tar.gz | tar xz
sudo mv initiat /usr/local/bin/
# Apple Silicon
curl -L https://github.com/${{ github.repository }}/releases/download/${{ github.event.inputs.version }}/initiat-darwin-arm64.tar.gz | tar xz
sudo mv initiat /usr/local/bin/
```
### Linux
```bash
# AMD64
curl -L https://github.com/${{ github.repository }}/releases/download/${{ github.event.inputs.version }}/initiat-linux-amd64.tar.gz | tar xz
sudo mv initiat /usr/local/bin/
# ARM64
curl -L https://github.com/${{ github.repository }}/releases/download/${{ github.event.inputs.version }}/initiat-linux-arm64.tar.gz | tar xz
sudo mv initiat /usr/local/bin/
```
**Note for Linux users**: The clipboard functionality requires X11 development libraries. Install them with:
```bash
# Ubuntu/Debian
sudo apt-get install libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev
# CentOS/RHEL/Fedora
sudo yum install libX11-devel libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel
# or for newer versions:
sudo dnf install libX11-devel libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel
# Arch Linux
sudo pacman -S libx11 libxrandr libxinerama libxcursor libxi
```
### Windows
Download the appropriate `.zip` file and extract it to your desired location.
### Verify Download (Optional)
```bash
# Download checksums
curl -L https://github.com/${{ github.repository }}/releases/download/${{ github.event.inputs.version }}/checksums.txt
# Verify your downloaded file
sha256sum -c checksums.txt --ignore-missing
```
## Quick Start
```bash
# Login to your Initiat account
initiat auth login user@example.com
# Register this device
initiat device register "My Computer"
# List available projects
initiat project list
```
## Documentation
- [Full Documentation](https://github.com/${{ github.repository }}/blob/main/README.md)
- [Changelog](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md)
- [Development Guide](https://github.com/${{ github.repository }}/blob/main/docs/DEV_BUILD.md)
## Homebrew (macOS)
```bash
brew tap InitiatDev/initiat
brew install initiat
```
update-homebrew:
name: Update Homebrew Tap
needs: release
runs-on: ubuntu-latest
steps:
- name: Checkout homebrew tap
uses: actions/checkout@v4
with:
repository: initiatdev/homebrew-initiat
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
path: homebrew-tap
- name: Download and run generator script
run: |
cd homebrew-tap
# Download the generator script from the homebrew repo
curl -L -o scripts/generate-formula.sh https://raw.githubusercontent.com/initiatdev/homebrew-initiat/main/scripts/generate-formula.sh
chmod +x scripts/generate-formula.sh
# Use release tag name or manual input
VERSION="${{ github.event.inputs.version }}"
./scripts/generate-formula.sh "$VERSION" --quiet > Formula/initiat.rb
- name: Commit and push changes
run: |
cd homebrew-tap
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add Formula/initiat.rb
VERSION="${{ github.event.inputs.version }}"
git commit -m "Update initiat to $VERSION"
git push