Skip to content

Release CLI

Release CLI #362

Workflow file for this run

name: Release CLI
on:
workflow_dispatch:
inputs:
version:
required: true
type: string
description: "The version of the CLI to build (e.g. v1.6.0-beta.1)"
distinct_id:
type: string
description: "Distinct ID"
required: false
jobs:
build:
name: Release - ${{ matrix.platform.release_for }}
strategy:
matrix:
platform:
- release_for: linux-aarch64
os: ubuntu-latest
goos: linux
goarch: arm64
bin_name: runtipi-cli
artifact_name: runtipi-cli-linux-aarch64
- release_for: linux-x86_64
os: ubuntu-latest
goos: linux
goarch: amd64
bin_name: runtipi-cli
artifact_name: runtipi-cli-linux-x86_64
runs-on: ${{ matrix.platform.os }}
steps:
- name: Echo distinct ID ${{ github.event.inputs.distinct_id }}
run: echo ${{ github.event.inputs.distinct_id }}
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: "1.24.2"
- name: Install dependencies
run: go mod download
- name: Build binary
env:
GOOS: ${{ matrix.platform.goos }}
GOARCH: ${{ matrix.platform.goarch }}
CGO_ENABLED: 0
run: |
go build -v -o ${{ matrix.platform.bin_name }} \
-ldflags="-X main.version=${{ inputs.version }} -X main.commit=$(git rev-parse --short HEAD) -X main.buildDate=$(date +%Y-%m-%dT%H:%M:%S%z) -s -w" \
./cmd/runtipi/main.go
- name: Compress with upx
run: |
sudo apt-get install -y upx
upx --best --lzma ${{ matrix.platform.bin_name }}
- name: Upload CLI
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform.artifact_name }}
path: ${{ matrix.platform.bin_name }}
release:
runs-on: ubuntu-latest
needs: [build]
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v5
- name: Move artifacts
run: for dir in runtipi-cli-linux-*; do mv "$dir/runtipi-cli" "${dir}.cli" && rm -rf "$dir" && mv "${dir}.cli" "$dir"; done
- name: Compress artifacts
run: for file in runtipi-cli-linux-*; do tar -czvf "$file.tar.gz" "$file" && rm -rf "$file"; done
- name: Create release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body: |
**${{ inputs.version }}**
tag_name: ${{ inputs.version }}
name: ${{ inputs.version }}
draft: false
prerelease: true
files: runtipi-cli-*