fix(release): supports darwin x86_64 (#637)
This commit is contained in:
parent
22243bc316
commit
67adc263ad
51
.github/workflows/release.yaml
vendored
51
.github/workflows/release.yaml
vendored
@ -48,28 +48,49 @@ jobs:
|
|||||||
releases-matrix:
|
releases-matrix:
|
||||||
needs: [create-release]
|
needs: [create-release]
|
||||||
strategy:
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
||||||
feature: [lua51, luajit]
|
feature: [lua51, luajit]
|
||||||
runs-on: ${{ matrix.os }}
|
config:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
os_name: linux
|
||||||
|
arch: x86_64
|
||||||
|
rust_target: x86_64-unknown-linux-gnu
|
||||||
|
- os: ubuntu-latest
|
||||||
|
os_name: linux
|
||||||
|
arch: aarch64
|
||||||
|
rust_target: aarch64-unknown-linux-gnu
|
||||||
|
- os: macos-13
|
||||||
|
os_name: darwin
|
||||||
|
arch: x86_64
|
||||||
|
rust_target: x86_64-apple-darwin
|
||||||
|
- os: macos-latest
|
||||||
|
os_name: darwin
|
||||||
|
arch: aarch64
|
||||||
|
rust_target: aarch64-apple-darwin
|
||||||
|
- os: windows-latest
|
||||||
|
os_name: windows
|
||||||
|
arch: x86_64
|
||||||
|
rust_target: x86_64-pc-windows-msvc
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.config.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
- uses: dtolnay/rust-toolchain@master
|
- uses: dtolnay/rust-toolchain@master
|
||||||
with:
|
with:
|
||||||
|
targets: ${{ matrix.config.rust_target }}
|
||||||
toolchain: 1.80.0
|
toolchain: 1.80.0
|
||||||
- name: Build all crates
|
- name: Build all crates
|
||||||
run: cargo build --release --features ${{ matrix.feature }}
|
run: cargo build --release --features ${{ matrix.feature }}
|
||||||
- name: Handle binaries
|
- name: Handle binaries
|
||||||
if: ${{ matrix.os != 'windows-latest' }}
|
if: ${{ matrix.config.os_name != 'windows' }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
mkdir -p results
|
mkdir -p results
|
||||||
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
|
if [ "${{ matrix.config.os_name }}" == "linux" ]; then
|
||||||
OS="linux"
|
|
||||||
EXT="so"
|
EXT="so"
|
||||||
else
|
else
|
||||||
OS="macOS"
|
|
||||||
EXT="dylib"
|
EXT="dylib"
|
||||||
fi
|
fi
|
||||||
cp target/release/libavante_templates.$EXT results/avante_templates.$EXT
|
cp target/release/libavante_templates.$EXT results/avante_templates.$EXT
|
||||||
@ -77,9 +98,9 @@ jobs:
|
|||||||
cp target/release/libavante_repo_map.$EXT results/avante_repo_map.$EXT
|
cp target/release/libavante_repo_map.$EXT results/avante_repo_map.$EXT
|
||||||
|
|
||||||
cd results
|
cd results
|
||||||
tar zcvf avante_lib-${{ matrix.os }}-${{ matrix.feature }}.tar.gz *.${EXT}
|
tar zcvf avante_lib-${{ matrix.config.os_name }}-${{ matrix.config.arch }}-${{ matrix.feature }}.tar.gz *.${EXT}
|
||||||
- name: Handle binaries (Windows)
|
- name: Handle binaries (Windows)
|
||||||
if: ${{ matrix.os == 'windows-latest' }}
|
if: ${{ matrix.config.os_name == 'windows' }}
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
New-Item -ItemType Directory -Force -Path results
|
New-Item -ItemType Directory -Force -Path results
|
||||||
@ -91,26 +112,26 @@ jobs:
|
|||||||
Set-Location -Path results
|
Set-Location -Path results
|
||||||
|
|
||||||
$dllFiles = Get-ChildItem -Filter "*.dll" | Select-Object -ExpandProperty Name
|
$dllFiles = Get-ChildItem -Filter "*.dll" | Select-Object -ExpandProperty Name
|
||||||
Compress-Archive -Path $dllFiles -DestinationPath "avante_lib-${{ matrix.os }}-${{ matrix.feature }}.zip"
|
Compress-Archive -Path $dllFiles -DestinationPath "avante_lib-${{ matrix.config.os_name }}-${{ matrix.config.arch }}-${{ matrix.feature }}.zip"
|
||||||
|
|
||||||
- name: Upload Release Asset
|
- name: Upload Release Asset
|
||||||
uses: shogo82148/actions-upload-release-asset@v1
|
uses: shogo82148/actions-upload-release-asset@v1
|
||||||
if: ${{ matrix.os != 'windows-latest' }}
|
if: ${{ matrix.config.os_name != 'windows' }}
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
ASSET_NAME: avante_lib-${{ matrix.os }}-${{ matrix.feature }}.tar.gz
|
ASSET_NAME: avante_lib-${{ matrix.config.os_name }}-${{ matrix.config.arch }}-${{ matrix.feature }}.tar.gz
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ needs.create-release.outputs.release_upload_url }}
|
upload_url: ${{ needs.create-release.outputs.release_upload_url }}
|
||||||
asset_path: ./results/avante_lib-${{ matrix.os }}-${{ matrix.feature }}.tar.gz
|
asset_path: ./results/avante_lib-${{ matrix.config.os_name }}-${{ matrix.config.arch }}-${{ matrix.feature }}.tar.gz
|
||||||
- name: Upload Release Asset (Windows)
|
- name: Upload Release Asset (Windows)
|
||||||
uses: shogo82148/actions-upload-release-asset@v1
|
uses: shogo82148/actions-upload-release-asset@v1
|
||||||
if: ${{ matrix.os == 'windows-latest' }}
|
if: ${{ matrix.config.os_name == 'windows' }}
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
ASSET_NAME: avante_lib-${{ matrix.os }}-${{ matrix.feature }}.zip
|
ASSET_NAME: avante_lib-${{ matrix.config.os_name }}-${{ matrix.config.arch }}-${{ matrix.feature }}.zip
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ needs.create-release.outputs.release_upload_url }}
|
upload_url: ${{ needs.create-release.outputs.release_upload_url }}
|
||||||
asset_path: ./results/avante_lib-${{ matrix.os }}-${{ matrix.feature }}.zip
|
asset_path: ./results/avante_lib-${{ matrix.config.os_name }}-${{ matrix.config.arch }}-${{ matrix.feature }}.zip
|
||||||
|
|
||||||
publish-release:
|
publish-release:
|
||||||
permissions:
|
permissions:
|
||||||
|
23
build.sh
23
build.sh
@ -11,10 +11,10 @@ TARGET_DIR="${SCRIPT_DIR}/build"
|
|||||||
# Get the artifact download URL based on the platform and Lua version
|
# Get the artifact download URL based on the platform and Lua version
|
||||||
case "$(uname -s)" in
|
case "$(uname -s)" in
|
||||||
Linux*)
|
Linux*)
|
||||||
PLATFORM="ubuntu"
|
PLATFORM="linux"
|
||||||
;;
|
;;
|
||||||
Darwin*)
|
Darwin*)
|
||||||
PLATFORM="macos"
|
PLATFORM="darwin"
|
||||||
;;
|
;;
|
||||||
CYGWIN* | MINGW* | MSYS*)
|
CYGWIN* | MINGW* | MSYS*)
|
||||||
PLATFORM="windows"
|
PLATFORM="windows"
|
||||||
@ -25,11 +25,28 @@ CYGWIN* | MINGW* | MSYS*)
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Get the architecture (x86_64 or aarch64)
|
||||||
|
case "$(uname -m)" in
|
||||||
|
x86_64)
|
||||||
|
ARCH="x86_64"
|
||||||
|
;;
|
||||||
|
aarch64)
|
||||||
|
ARCH="aarch64"
|
||||||
|
;;
|
||||||
|
arm64)
|
||||||
|
ARCH="aarch64"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unsupported architecture"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Set the Lua version (lua54 or luajit)
|
# Set the Lua version (lua54 or luajit)
|
||||||
LUA_VERSION="${LUA_VERSION:-luajit}"
|
LUA_VERSION="${LUA_VERSION:-luajit}"
|
||||||
|
|
||||||
# Set the artifact name pattern
|
# Set the artifact name pattern
|
||||||
ARTIFACT_NAME_PATTERN="avante_lib-$PLATFORM-latest-$LUA_VERSION"
|
ARTIFACT_NAME_PATTERN="avante_lib-$PLATFORM-$ARCH-$LUA_VERSION"
|
||||||
|
|
||||||
# Get the artifact download URL
|
# Get the artifact download URL
|
||||||
ARTIFACT_URL=$(curl -s "https://api.github.com/repos/yetone/avante.nvim/releases/latest" | grep "browser_download_url" | cut -d '"' -f 4 | grep $ARTIFACT_NAME_PATTERN)
|
ARTIFACT_URL=$(curl -s "https://api.github.com/repos/yetone/avante.nvim/releases/latest" | grep "browser_download_url" | cut -d '"' -f 4 | grep $ARTIFACT_NAME_PATTERN)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user