Skip to content

Release CLI

Release CLI #182

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
target: aarch64-unknown-linux-musl
bin: runtipi-cli
name: runtipi-cli-linux-aarch64
command: build
- release_for: linux-x86_64
os: ubuntu-latest
target: x86_64-unknown-linux-musl
bin: runtipi-cli
name: runtipi-cli-linux-x86_64
command: build
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
with:
ref: main
- name: Set version in src/assets/VERSION
run: |
echo "${{ inputs.version }}" > src/assets/VERSION
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build binary
run: cross ${{ matrix.platform.command }} --target ${{ matrix.platform.target }} --release
- name: Upload CLI
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform.name }}
path: target/${{ matrix.platform.target }}/release/${{ matrix.platform.bin }}
release:
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main
- name: Download all artifacts
uses: actions/download-artifact@v4
- 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: List artifacts
run: tree .
- name: Create release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body: |
**${{ inputs.version }}**
tag_name: ${{ inputs.version }}
name: ${{ inputs.version }}
draft: false
prerelease: true
files: runtipi-cli-*