Skip to content

fix: disable default-tls for build-dep reqwest to avoid openssl in CI #53

fix: disable default-tls for build-dep reqwest to avoid openssl in CI

fix: disable default-tls for build-dep reqwest to avoid openssl in CI #53

Workflow file for this run

name: Release
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: write
pull-requests: write
env:
CARGO_TERM_COLOR: always
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.rp.outputs.release_created }}
tag_name: ${{ steps.rp.outputs.tag_name }}
steps:
- uses: googleapis/release-please-action@v4
id: rp
with:
release-type: rust
build:
needs: release-please
if: needs.release-please.outputs.release_created == 'true'
strategy:
matrix:
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
artifact: eai-linux-amd64
use_cross: true
binary: eai
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
artifact: eai-linux-arm64
use_cross: true
binary: eai
- target: x86_64-apple-darwin
os: macos-latest
artifact: eai-darwin-amd64
use_cross: false
binary: eai
- target: aarch64-apple-darwin
os: macos-latest
artifact: eai-darwin-arm64
use_cross: false
binary: eai
- target: x86_64-pc-windows-msvc
os: windows-latest
artifact: eai-windows-amd64
use_cross: false
binary: eai.exe
- target: aarch64-pc-windows-msvc
os: windows-latest
artifact: eai-windows-arm64
use_cross: false
binary: eai.exe
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Install cross
if: matrix.use_cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build (cross)
if: matrix.use_cross
run: cross build --release --target ${{ matrix.target }}
- name: Build (cargo)
if: "!matrix.use_cross"
run: cargo build --release --target ${{ matrix.target }}
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: target/${{ matrix.target }}/release/${{ matrix.binary }}
upload-assets:
needs: [release-please, build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Upload binaries to release
env:
GH_TOKEN: ${{ github.token }}
run: |
cp artifacts/eai-linux-amd64/eai artifacts/eai-linux-amd64/eai-linux-amd64
cp artifacts/eai-linux-arm64/eai artifacts/eai-linux-arm64/eai-linux-arm64
cp artifacts/eai-darwin-amd64/eai artifacts/eai-darwin-amd64/eai-darwin-amd64
cp artifacts/eai-darwin-arm64/eai artifacts/eai-darwin-arm64/eai-darwin-arm64
cp artifacts/eai-windows-amd64/eai.exe artifacts/eai-windows-amd64/eai-windows-amd64.exe
cp artifacts/eai-windows-arm64/eai.exe artifacts/eai-windows-arm64/eai-windows-arm64.exe
for platform in linux-amd64 linux-arm64 darwin-amd64 darwin-arm64; do
chmod +x artifacts/eai-${platform}/eai
tar -czf artifacts/eai-${platform}.tar.gz -C artifacts/eai-${platform} eai
done
cd artifacts/eai-windows-amd64 && zip eai-windows-amd64.zip eai-windows-amd64.exe && cd ../..
cd artifacts/eai-windows-arm64 && zip eai-windows-arm64.zip eai-windows-arm64.exe && cd ../..
gh release upload ${{ needs.release-please.outputs.tag_name }} \
artifacts/eai-linux-amd64/eai-linux-amd64 \
artifacts/eai-linux-arm64/eai-linux-arm64 \
artifacts/eai-darwin-amd64/eai-darwin-amd64 \
artifacts/eai-darwin-arm64/eai-darwin-arm64 \
artifacts/eai-linux-amd64.tar.gz \
artifacts/eai-linux-arm64.tar.gz \
artifacts/eai-darwin-amd64.tar.gz \
artifacts/eai-darwin-arm64.tar.gz \
artifacts/eai-windows-amd64/eai-windows-amd64.exe \
artifacts/eai-windows-arm64/eai-windows-arm64.exe \
artifacts/eai-windows-amd64/eai-windows-amd64.zip \
artifacts/eai-windows-arm64/eai-windows-arm64.zip
homebrew:
needs: [release-please, upload-assets]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update Homebrew formula
env:
GH_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
TAG: ${{ needs.release-please.outputs.tag_name }}
GITHUB_REPOSITORY: ${{ github.repository }}
run: |
set -euo pipefail
VERSION="${TAG#v}"
BASE_URL="https://github.com/${GITHUB_REPOSITORY}/releases/download/${TAG}"
fetch_tarball() {
local platform="$1" dest="/tmp/eai-${platform}.tar.gz"
for i in 1 2 3 4 5 6 7 8 9 10; do
if curl -fSL --retry 3 --retry-delay 2 "${BASE_URL}/eai-${platform}.tar.gz" -o "$dest"; then
return 0
fi
sleep 3
done
return 1
}
for platform in darwin-amd64 darwin-arm64 linux-amd64 linux-arm64; do
fetch_tarball "$platform"
done
SHA_DARWIN_AMD64=$(sha256sum /tmp/eai-darwin-amd64.tar.gz | cut -d' ' -f1)
SHA_DARWIN_ARM64=$(sha256sum /tmp/eai-darwin-arm64.tar.gz | cut -d' ' -f1)
SHA_LINUX_AMD64=$(sha256sum /tmp/eai-linux-amd64.tar.gz | cut -d' ' -f1)
SHA_LINUX_ARM64=$(sha256sum /tmp/eai-linux-arm64.tar.gz | cut -d' ' -f1)
sed -e "s|GITHUB_REPOSITORY|${GITHUB_REPOSITORY}|g" \
-e "s/VERSION_PLACEHOLDER/${VERSION}/" \
-e "s/SHA_DARWIN_AMD64/${SHA_DARWIN_AMD64}/" \
-e "s/SHA_DARWIN_ARM64/${SHA_DARWIN_ARM64}/" \
-e "s/SHA_LINUX_AMD64/${SHA_LINUX_AMD64}/" \
-e "s/SHA_LINUX_ARM64/${SHA_LINUX_ARM64}/" \
homebrew-tap/Formula/eai.rb > /tmp/eai.rb
TAP_SLUG="homebrew-tap"
TAP_REPO="${GITHUB_REPOSITORY%%/*}/${TAP_SLUG}"
git clone "https://x-access-token:${GH_TOKEN}@github.com/${TAP_REPO}.git" /tmp/tap
mkdir -p /tmp/tap/Formula
cp /tmp/eai.rb /tmp/tap/Formula/eai.rb
cd /tmp/tap
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/eai.rb
if git diff --staged --quiet; then
echo "No formula changes to commit."
exit 0
fi
git commit -m "eai ${VERSION}"
git push
winget:
needs: [release-please, upload-assets]
runs-on: windows-latest
continue-on-error: true
steps:
- uses: vedantmgoyal9/winget-releaser@v2
with:
identifier: feliperbroering.eai
installers-regex: eai-windows-.*\.zip$
token: ${{ secrets.WINGET_TOKEN }}
version: ${{ needs.release-please.outputs.tag_name }}