Skip to content

Release CLI

Release CLI #7

Workflow file for this run

# # Run for macOS
# act -W .github/workflows/release-cli.yml --container-architecture linux/amd64 -j build-macos -P macos-latest=-self-hosted
# # Run for Linux
# act -W .github/workflows/release-cli.yml --container-architecture linux/amd64 -j build-ubuntu -P ubuntu-24.04
name: Release CLI
on:
push:
tags:
- "v*"
workflow_dispatch:
jobs:
build-macos:
runs-on: macos-latest
strategy:
matrix:
target: [x86_64-apple-darwin, aarch64-apple-darwin]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}
- name: Install dependencies
run: |
brew install ffmpeg
- name: Set up pkg-config for cross-compilation
run: |
if [ "${{ matrix.target }}" = "aarch64-apple-darwin" ]; then
echo "PKG_CONFIG_PATH=/opt/homebrew/lib/pkgconfig" >> $GITHUB_ENV
echo "PKG_CONFIG_LIBDIR=/opt/homebrew/lib/pkgconfig" >> $GITHUB_ENV
else
echo "PKG_CONFIG_PATH=/usr/local/lib/pkgconfig" >> $GITHUB_ENV
echo "PKG_CONFIG_LIBDIR=/usr/local/lib/pkgconfig" >> $GITHUB_ENV
fi
- name: Build with Metal feature
run: |
cargo build --release --features metal --target ${{ matrix.target }}
- name: Create deployment package
run: |
VERSION=${GITHUB_REF#refs/tags/v}
tar -czf screenpipe-${VERSION}-${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release screenpipe
- name: Calculate SHA256
run: |
echo "MAC_SHA256_${{ matrix.target }}=$(shasum -a 256 screenpipe-*.tar.gz | cut -d ' ' -f 1)" >> $GITHUB_ENV
- name: Update Homebrew Formula
run: |
VERSION=${GITHUB_REF#refs/tags/v}
sed 's/version ".*"/version "'$VERSION'"/' Formula/screenpipe.rb > Formula/screenpipe.tmp && mv Formula/screenpipe.tmp Formula/screenpipe.rb
if [ "${{ matrix.target }}" = "x86_64-apple-darwin" ]; then
sed 's/sha256 ".*" # x86_64/sha256 "'${{ env.MAC_SHA256_x86_64-apple-darwin }}'" # x86_64/' Formula/screenpipe.rb > Formula/screenpipe.tmp && mv Formula/screenpipe.tmp Formula/screenpipe.rb
else
sed 's/sha256 ".*" # arm64/sha256 "'${{ env.MAC_SHA256_aarch64-apple-darwin }}'" # arm64/' Formula/screenpipe.rb > Formula/screenpipe.tmp && mv Formula/screenpipe.tmp Formula/screenpipe.rb
fi
sed 's|v[0-9.]*\/screenpipe-[0-9.]*-${{ matrix.target }}|v'$VERSION'\/screenpipe-'$VERSION'-${{ matrix.target }}|' Formula/screenpipe.rb > Formula/screenpipe.tmp && mv Formula/screenpipe.tmp Formula/screenpipe.rb
- name: Commit and push Homebrew Formula changes
env:
GH_TOKEN: ${{ secrets.PAT }}
run: |
git config user.name github-actions
git config user.email [email protected]
git add Formula/screenpipe.rb
git commit -m "chore: update brew to version ${GITHUB_REF#refs/tags/v} for ${{ matrix.target }}"
git push
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: screenpipe-macos-${{ matrix.target }}
path: screenpipe-*.tar.gz
build-ubuntu:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libavformat-dev libavfilter-dev libavdevice-dev ffmpeg libasound2-dev
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Build with RPATH
run: |
export PKG_CONFIG_PATH="/usr/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH"
export RUSTFLAGS="-C link-arg=-Wl,-rpath,\$ORIGIN/lib"
cargo build --release
- name: Copy FFmpeg libraries
run: |
mkdir -p target/release/lib
cp /usr/lib/x86_64-linux-gnu/libavcodec.so* target/release/lib/
cp /usr/lib/x86_64-linux-gnu/libavformat.so* target/release/lib/
cp /usr/lib/x86_64-linux-gnu/libavutil.so* target/release/lib/
cp /usr/lib/x86_64-linux-gnu/libswresample.so* target/release/lib/
cp /usr/lib/x86_64-linux-gnu/libswscale.so* target/release/lib/
cp /usr/lib/x86_64-linux-gnu/libavfilter.so* target/release/lib/
cp /usr/lib/x86_64-linux-gnu/libavdevice.so* target/release/lib/
- name: Create deployment package
run: |
mkdir -p screenpipe-linux
cp target/release/screenpipe screenpipe-linux/screenpipe
cp -r target/release/lib screenpipe-linux/
chmod +x screenpipe-linux/screenpipe
tar -czvf screenpipe-linux.tar.gz screenpipe-linux
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: screenpipe-linux
path: screenpipe-linux.tar.gz
build-windows:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Download FFmpeg
run: |
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri "https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl-shared.zip" -OutFile "ffmpeg.zip"
Expand-Archive -Path "ffmpeg.zip" -DestinationPath "ffmpeg"
Move-Item -Path "ffmpeg\ffmpeg-master-latest-win64-gpl-shared" -Destination "C:\ffmpeg"
- name: Set up environment
run: |
echo "C:\ffmpeg\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "FFMPEG_DIR=C:\ffmpeg" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "PKG_CONFIG_PATH=C:\ffmpeg\lib\pkgconfig" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Build release
run: |
cargo build --release --verbose
- name: Create deployment package
run: |
$VERSION = $env:GITHUB_REF -replace 'refs/tags/v', ''
New-Item -ItemType Directory -Path "screenpipe-win64"
Copy-Item "target\release\screenpipe.exe" -Destination "screenpipe-win64"
Copy-Item "C:\ffmpeg\bin\*.dll" -Destination "screenpipe-win64"
Compress-Archive -Path "screenpipe-win64" -DestinationPath "screenpipe-$VERSION-x86_64-pc-windows-msvc.zip"
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: screenpipe-windows
path: screenpipe-*.zip
release:
runs-on: ubuntu-latest
needs: [build-ubuntu, build-macos, build-windows]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
name: screenpipe-linux
- name: Download macOS Artifact Intel
uses: actions/download-artifact@v2
with:
name: screenpipe-macos-x86_64-apple-darwin
- name: Download macOS Artifact ARM
uses: actions/download-artifact@v2
with:
name: screenpipe-macos-aarch64-apple-darwin
- name: Download Windows Artifact
uses: actions/download-artifact@v2
with:
name: screenpipe-windows
- name: Set Version
shell: bash
run: |
echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
echo "RELEASE_VERSION=$(echo ${GITHUB_REF_NAME} | cut -f1 -d-)" >> $GITHUB_ENV
- name: Create or update Release
env:
GH_TOKEN: ${{ secrets.PAT }}
run: |
gh release create ${{ env.RELEASE_VERSION }} --title ${{ env.RELEASE_VERSION }} --generate-notes
gh release upload ${{ env.RELEASE_VERSION }} screenpipe-linux.tar.gz
gh release upload ${{ env.RELEASE_VERSION }} screenpipe-macos-x86_64-apple-darwin
gh release upload ${{ env.RELEASE_VERSION }} screenpipe-macos-aarch64-apple-darwin
gh release upload ${{ env.RELEASE_VERSION }} screenpipe-windows.zip