Skip to content

remove darwin path of condition #60

remove darwin path of condition

remove darwin path of condition #60

Workflow file for this run

name: Ahnlich AI and DB Release
on:
push:
branches: "*"
# release:
# types: [published]
permissions:
contents: write
jobs:
prebuild_preparation:
name: Get Binary Type
runs-on: ubuntu-latest
outputs:
bin_name: ${{ steps.get_binary_type.outputs.BIN_NAME }}
bin_suffix: ${{ steps.get_binary_type.outputs.BIN_SUFFIX }}
steps:
- name: "Checkout"
uses: actions/checkout@v4
- name: "Get Binary Type"
id: get_binary_type
# run: |
# cd ${{github.workspace}}
# echo ${{ github.event.release.tag_name }}
# value=$(echo "${{ github.event.release.tag_name }}" | cut -d'/' -f2)
# echo "$value"
# echo "BIN_SUFFIX=${value}" >> $GITHUB_OUTPUT
# echo "BIN_NAME=ahnlich-${value}" >> $GITHUB_OUTPUT
run: |
echo "BIN_SUFFIX=ai" >> $GITHUB_OUTPUT
echo "BIN_NAME=ahnlich-ai" >> $GITHUB_OUTPUT
build_binaries_and_publish:
needs: prebuild_preparation
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
runner: ubuntu-22.04
- target: aarch64-unknown-linux-gnu
runner: ubuntu-22.04-arm
- target: x86_64-apple-darwin
runner: macos-latest
- target: aarch64-apple-darwin
runner: macos-latest
name: Build ${{ matrix.target }} Binaries
runs-on: ${{ matrix.runner }}
outputs:
bin_name: ${{ needs.prebuild_preparation.outputs.bin_name }}
steps:
- name: "Checkout"
uses: actions/checkout@v4
- name: Get Cargo toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.87.0
- name: Build Linux Release for ${{ needs.prebuild_preparation.outputs.bin_name }}
working-directory: ./ahnlich
run: |
rm types/build.rs
rustup target add ${{matrix.target}}
export MATRIX_TARGET=${{matrix.target}}
echo $MATRIX_TARGET
if [[ $BIN_NAME == "ahnlich-ai" ]] ; then
echo "running with coreml.."
cargo build --features coreml --release --target ${{matrix.target}} --bin ${{ needs.prebuild_preparation.outputs.bin_name }}
else
echo "running without features"
cargo build --release --target ${{matrix.target}} --bin ${{ needs.prebuild_preparation.outputs.bin_name }}
fi
tar -cvzf ${{matrix.target}}-${{ needs.prebuild_preparation.outputs.bin_name }}.tar.gz -C target/${{matrix.target}}/release ${{ needs.prebuild_preparation.outputs.bin_name }}
# gh release upload ${{github.event.release.tag_name}} ${{matrix.target}}-${{ needs.prebuild_preparation.outputs.bin_name }}.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
shell: bash
# push_to_registries:
# needs: prebuild_preparation
# name: Push Docker image to multiple registries
# runs-on: ubuntu-latest
# if: ${{needs.prebuild_preparation.outputs.bin_name != 'ahnlich-cli'}}
# permissions:
# packages: write
# contents: read
# attestations: write
# id-token: write
# steps:
# - name: Check out the repo
# uses: actions/checkout@v4
# - name: Cache Docker images
# uses: ScribeMD/[email protected]
# with:
# key: ${{ runner.os }}-cargo-${{ hashFiles('ahnlich/Cargo.lock') }}
# - name: Install Protoc
# uses: arduino/setup-protoc@v3
# - name: Set Port Based on Bin Name
# id: set_port
# run: |
# if [ "${{ needs.prebuild_preparation.outputs.bin_name }}" == "ahnlich-db" ]; then
# echo "DEFAULT_PORT=1369" >> $GITHUB_ENV
# echo "DESCRIPTION=Ahnlich DB" >> $GITHUB_ENV
# else
# echo "DEFAULT_PORT=1370" >> $GITHUB_ENV
# echo "DESCRIPTION=Ahnlich AI" >> $GITHUB_ENV
# fi
# - name: Extract version number from tag
# id: extract_version
# working-directory: ./ahnlich
# run: |
# # Extract only the numerical version part from the tag
# VERSION=$(make workspace-crate-version CRATE_NAME=${{ needs.prebuild_preparation.outputs.bin_suffix }} | tail -n 1)
# echo $VERSION
# echo "BIN_VERSION=$VERSION" >> $GITHUB_ENV
# - name: Log in to the Container registry
# uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
# with:
# registry: ghcr.io
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GH_GCR_TOKEN }}
# - name: Extract metadata (tags, labels) for Docker
# id: meta
# uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
# with:
# images: ghcr.io/${{ github.repository_owner }}/${{needs.prebuild_preparation.outputs.bin_name}}
# tags: |
# type=schedule
# type=semver,pattern={{version}},value=v${{env.BIN_VERSION}}
# labels: |
# org.opencontainers.image.description=${{ env.DESCRIPTION }}
# - name: Build and push Docker images
# id: push
# uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85
# with:
# context: ./ahnlich
# push: true
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
# build-args: |
# AHNLICH_BIN=${{ needs.prebuild_preparation.outputs.bin_name}}
# DEFAULT_PORT=${{env.DEFAULT_PORT}}
# - name: Generate artifact attestation
# uses: actions/attest-build-provenance@v1
# with:
# subject-name: ghcr.io/${{ github.repository_owner }}/${{needs.prebuild_preparation.outputs.bin_name}}
# subject-digest: ${{ steps.push.outputs.digest }}
# push-to-registry: true