Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 58 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ jobs:
build:
name: Build for ${{ matrix.target }}
runs-on: ${{ matrix.os }}
continue-on-error: true
outputs:
version: ${{ steps.get-version.outputs.version }}
strategy:
Expand All @@ -22,15 +21,21 @@ jobs:
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
artifact_name: git-ai-linux-x64
use_docker: true
docker_image: ubuntu:20.04
- os: ubuntu-22.04-arm
target: aarch64-unknown-linux-gnu
artifact_name: git-ai-linux-arm64
use_docker: true
docker_image: ubuntu:20.04
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: git-ai-windows-x64
use_docker: false
- os: macos-latest
target: aarch64-apple-darwin
artifact_name: git-ai-macos-arm64
use_docker: false

steps:
- name: Checkout code
Expand All @@ -43,34 +48,67 @@ jobs:
VERSION=$(grep '^version = ' Cargo.toml | cut -d'"' -f2)
echo "version=v$VERSION" >> $GITHUB_OUTPUT

- name: Install Rust toolchain
- name: Build in Docker (Linux)
if: matrix.use_docker == true
run: |
docker run --rm \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
-e DEBIAN_FRONTEND=noninteractive \
${{ matrix.docker_image }} \
bash -c "
apt-get update && \
apt-get install -y curl build-essential pkg-config libssl-dev && \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --target ${{ matrix.target }} && \
. \$HOME/.cargo/env && \
cargo build --release --target ${{ matrix.target }} && \
strip target/${{ matrix.target }}/release/git-ai
"

- name: Install Rust toolchain (non-Docker)
if: matrix.use_docker == false
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true

- name: Cache dependencies
- name: Cache dependencies (non-Docker)
if: matrix.use_docker == false
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ matrix.target }}-

- name: Build release binary
- name: Build release binary (non-Docker)
if: matrix.use_docker == false
run: |
cargo build --release --target ${{ matrix.target }}
env:
CARGO_INCREMENTAL: 0

- name: Strip binary (Linux)
- name: Verify binary architecture (Linux)
if: contains(matrix.os, 'ubuntu')
run: |
strip target/${{ matrix.target }}/release/git-ai
file target/${{ matrix.target }}/release/git-ai
ldd target/${{ matrix.target }}/release/git-ai || true
echo "Required GLIBC version:"
objdump -T target/${{ matrix.target }}/release/git-ai | grep GLIBC | sed 's/.*GLIBC_/GLIBC_/' | sort -V | uniq | tail -1

- name: Verify binary architecture (Windows)
if: matrix.os == 'windows-latest'
shell: bash
run: |
file target/${{ matrix.target }}/release/git-ai.exe

- name: Strip binary (Windows)
if: matrix.os == 'windows-latest'
run: |
strip target/${{ matrix.target }}/release/git-ai.exe

- name: Strip binary (macOS)
if: matrix.os == 'macos-latest'
Expand Down Expand Up @@ -109,8 +147,7 @@ jobs:

build-macos-intel:
name: Build for macOS Intel
runs-on: macos-latest
continue-on-error: true
runs-on: macos-13
outputs:
version: ${{ steps.get-version.outputs.version }}

Expand All @@ -129,6 +166,7 @@ jobs:
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-apple-darwin
override: true

- name: Cache dependencies
Expand All @@ -137,28 +175,32 @@ jobs:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-x86_64-apple-darwin-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-x86_64-apple-darwin-

- name: Build release binary (native)
- name: Build release binary
run: |
cargo build --release
cargo build --release --target x86_64-apple-darwin
env:
CARGO_INCREMENTAL: 0

- name: Strip binary (macOS)
- name: Verify binary architecture
run: |
file target/x86_64-apple-darwin/release/git-ai
lipo -info target/x86_64-apple-darwin/release/git-ai

- name: Strip binary
run: |
strip target/release/git-ai
strip target/x86_64-apple-darwin/release/git-ai

- name: Create release directory
run: |
mkdir -p release

- name: Copy binary to release directory
run: |
cp target/release/git-ai release/git-ai-macos-x64
cp target/x86_64-apple-darwin/release/git-ai release/git-ai-macos-x64

- name: Upload artifact
uses: actions/upload-artifact@v4
Expand All @@ -171,7 +213,7 @@ jobs:
name: Create Release
needs: [build, build-macos-intel]
runs-on: ubuntu-latest
if: always() && inputs.dry_run != true
if: success() && inputs.dry_run != true

steps:
- name: Download all artifacts
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "git-ai"
version = "1.0.5"
version = "1.0.6"
edition = "2024"


Expand Down
Loading