name: Build and Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
artifact: onepassword-mcp
archive: onepassword-mcp-linux-x86_64.tar.gz
- target: x86_64-pc-windows-gnu
os: ubuntu-latest
artifact: onepassword-mcp.exe
archive: onepassword-mcp-windows-x86_64.zip
- target: x86_64-apple-darwin
os: macos-latest
artifact: onepassword-mcp
archive: onepassword-mcp-macos-x86_64.tar.gz
- target: aarch64-apple-darwin
os: macos-latest
artifact: onepassword-mcp
archive: onepassword-mcp-macos-aarch64.tar.gz
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-action@stable
with:
targets: ${{ matrix.target }}
- name: Install cross-compilation dependencies (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libssl-dev pkg-config
if [[ "${{ matrix.target }}" == "x86_64-pc-windows-gnu" ]]; then
sudo apt-get install -y mingw-w64
fi
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Package (Unix)
if: matrix.os != 'ubuntu-latest' || matrix.target != 'x86_64-pc-windows-gnu'
run: |
cd target/${{ matrix.target }}/release
tar czf ../../../${{ matrix.archive }} ${{ matrix.artifact }}
- name: Package (Windows)
if: matrix.target == 'x86_64-pc-windows-gnu'
run: |
cd target/${{ matrix.target }}/release
zip ../../../${{ matrix.archive }} ${{ matrix.artifact }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.archive }}
path: ${{ matrix.archive }}
release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
onepassword-mcp-linux-x86_64.tar.gz/onepassword-mcp-linux-x86_64.tar.gz
onepassword-mcp-windows-x86_64.zip/onepassword-mcp-windows-x86_64.zip
onepassword-mcp-macos-x86_64.tar.gz/onepassword-mcp-macos-x86_64.tar.gz
onepassword-mcp-macos-aarch64.tar.gz/onepassword-mcp-macos-aarch64.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}