Skip to content

feat: show all operations by default in ops command #17

feat: show all operations by default in ops command

feat: show all operations by default in ops command #17

Workflow file for this run

name: Release
on:
push:
branches: [main]
# Only one release at a time — if a new push arrives while releasing,
# the queued run waits and then computes the next version from the new tag.
concurrency:
group: release
cancel-in-progress: false
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
BINARY_NAME: switchboard
jobs:
check:
name: Pre-release checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --check
- run: cargo clippy -- -D warnings
- run: cargo test --bin switchboard
version:
name: Resolve next version
needs: check
runs-on: ubuntu-latest
outputs:
version: ${{ steps.next.outputs.version }}
tag: ${{ steps.next.outputs.tag }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Compute next version from latest tag
id: next
run: |
LATEST_TAG=$(git tag -l 'v*' --sort=-v:refname | head -1)
if [ -z "$LATEST_TAG" ]; then
NEXT="0.1.0"
else
CURRENT="${LATEST_TAG#v}"
MAJOR=$(echo "$CURRENT" | cut -d. -f1)
MINOR=$(echo "$CURRENT" | cut -d. -f2)
PATCH=$(echo "$CURRENT" | cut -d. -f3)
NEXT="${MAJOR}.${MINOR}.$((PATCH + 1))"
fi
echo "version=${NEXT}" >> "$GITHUB_OUTPUT"
echo "tag=v${NEXT}" >> "$GITHUB_OUTPUT"
echo "Next release: v${NEXT}"
build:
name: Build ${{ matrix.archive }}
needs: version
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
archive: linux-x86_64
- target: aarch64-apple-darwin
os: macos-14
archive: darwin-aarch64
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Set version in Cargo.toml
run: |
sed -i.bak 's/^version = ".*"/version = "${{ needs.version.outputs.version }}"/' Cargo.toml
rm -f Cargo.toml.bak
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Strip binary (Linux)
if: runner.os == 'Linux'
run: strip target/${{ matrix.target }}/release/${{ env.BINARY_NAME }}
- name: Strip and sign binary (macOS)
if: runner.os == 'macOS'
run: |
strip target/${{ matrix.target }}/release/${{ env.BINARY_NAME }}
codesign --force --sign - target/${{ matrix.target }}/release/${{ env.BINARY_NAME }}
- name: Package
run: |
cd target/${{ matrix.target }}/release
tar czf ../../../${{ env.BINARY_NAME }}-${{ needs.version.outputs.tag }}-${{ matrix.archive }}.tar.gz ${{ env.BINARY_NAME }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.archive }}
path: ${{ env.BINARY_NAME }}-${{ needs.version.outputs.tag }}-${{ matrix.archive }}.tar.gz
release:
name: Create Release
needs: [version, build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Generate checksums
run: |
cd artifacts
sha256sum * > checksums-sha256.txt
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.version.outputs.tag }}
name: ${{ needs.version.outputs.tag }}
generate_release_notes: true
body: |
## Install
```bash
curl -fsSL https://raw.githubusercontent.com/liberuum/switchboard-cli/main/install.sh | bash
```
Or download a binary below, extract, and run:
```bash
# macOS — clear quarantine flag after extracting
xattr -d com.apple.quarantine ./switchboard
# Then move to PATH
sudo mv switchboard /usr/local/bin/
```
files: |
artifacts/*
- name: Sync Cargo.toml version
run: |
sed -i 's/^version = ".*"/version = "${{ needs.version.outputs.version }}"/' Cargo.toml
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Cargo.toml
git diff --cached --quiet || (git commit -m "chore: release v${{ needs.version.outputs.version }}" && git push)