mirror of
https://github.com/ollama/ollama.git
synced 2025-05-11 02:16:36 +02:00
fix release workflow
This commit is contained in:
parent
50566113ac
commit
e806184023
4 changed files with 53 additions and 47 deletions
57
.github/workflows/release.yaml
vendored
57
.github/workflows/release.yaml
vendored
|
@ -81,7 +81,7 @@ jobs:
|
||||||
path: dist/darwin-arm64
|
path: dist/darwin-arm64
|
||||||
- run: |
|
- run: |
|
||||||
export VERSION=${GITHUB_REF_NAME#v}
|
export VERSION=${GITHUB_REF_NAME#v}
|
||||||
./scripts/build_darwin.sh macapp sign
|
./scripts/build_darwin.sh sign macapp
|
||||||
env:
|
env:
|
||||||
APPLE_IDENTITY: ${{ secrets.APPLE_IDENTITY }}
|
APPLE_IDENTITY: ${{ secrets.APPLE_IDENTITY }}
|
||||||
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
|
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
|
||||||
|
@ -197,33 +197,38 @@ jobs:
|
||||||
env:
|
env:
|
||||||
GOFLAGS: ${{ needs.setup-environment.outputs.GOFLAGS }}
|
GOFLAGS: ${{ needs.setup-environment.outputs.GOFLAGS }}
|
||||||
steps:
|
steps:
|
||||||
- name: Install system dependencies
|
- name: Install AMD64 system dependencies
|
||||||
|
if: matrix.arch == 'amd64'
|
||||||
run: |
|
run: |
|
||||||
$ErrorActionPreference = "Stop"
|
$ErrorActionPreference = "Stop"
|
||||||
if ("${{ matrix.arch }}" -eq 'amd64') {
|
Start-Process "C:\msys64\usr\bin\pacman.exe" -ArgumentList @("-S", "--noconfirm", "mingw-w64-clang-x86_64-gcc-compat", "mingw-w64-clang-x86_64-clang") -NoNewWindow -Wait
|
||||||
Start-Process "C:\msys64\usr\bin\pacman.exe" -ArgumentList @("-S", "--noconfirm", "mingw-w64-clang-x86_64-gcc-compat", "mingw-w64-clang-x86_64-clang") -NoNewWindow -Wait
|
echo "C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||||
echo "C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
echo "C:\msys64\clang64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||||
echo "C:\msys64\clang64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
- name: Install ARM64 system dependencies
|
||||||
} elseif ("${{ matrix.arch }}" -eq 'arm64') {
|
if: matrix.arch == 'arm64'
|
||||||
Set-ExecutionPolicy Bypass -Scope Process -Force
|
run: |
|
||||||
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
|
$ErrorActionPreference = "Stop"
|
||||||
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
|
Set-ExecutionPolicy Bypass -Scope Process -Force
|
||||||
echo "C:\ProgramData\chocolatey\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
|
||||||
|
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
|
||||||
|
echo "C:\ProgramData\chocolatey\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||||
|
|
||||||
choco install -y --no-progress git gzip
|
choco install -y --no-progress git gzip
|
||||||
echo "C:\Program Files\Git\cmd" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
echo "C:\Program Files\Git\cmd" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||||
|
|
||||||
Invoke-WebRequest -Uri "https://github.com/mstorsjo/llvm-mingw/releases/download/20240619/llvm-mingw-20240619-ucrt-aarch64.zip" -OutFile "${{ runner.temp }}\llvm-mingw-ucrt-aarch64.zip"
|
Invoke-WebRequest -Uri "https://github.com/mstorsjo/llvm-mingw/releases/download/20240619/llvm-mingw-20240619-ucrt-aarch64.zip" -OutFile "${{ runner.temp }}\llvm-mingw-ucrt-aarch64.zip"
|
||||||
Expand-Archive -Path ${{ runner.temp }}\llvm-mingw-ucrt-aarch64.zip -DestinationPath "C:\Program Files\"
|
Expand-Archive -Path ${{ runner.temp }}\llvm-mingw-ucrt-aarch64.zip -DestinationPath "C:\Program Files\"
|
||||||
$installPath=(Resolve-Path -Path "C:\Program Files\llvm-mingw-*-ucrt-aarch64").path
|
$installPath=(Resolve-Path -Path "C:\Program Files\llvm-mingw-*-ucrt-aarch64").path
|
||||||
echo $installPath\bin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
echo $installPath\bin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||||
}
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version-file: go.mod
|
go-version-file: go.mod
|
||||||
- run: |
|
- run: |
|
||||||
go build -o dist/${{ matrix.os }}-${{ matrix.arch }}/ .
|
go build -o dist/${{ matrix.os }}-${{ matrix.arch }}/ .
|
||||||
|
- if: matrix.arch == 'arm64'
|
||||||
|
run: |
|
||||||
|
Invoke-WebRequest -Uri "https://aka.ms/vs/17/release/vc_redist.arm64.exe" -OutFile "dist\windows-arm64\vc_redist.arm64.exe"
|
||||||
- run: |
|
- run: |
|
||||||
$env:VERSION='${{ github.ref_name }}' -Replace "v(.*)", '$1'
|
$env:VERSION='${{ github.ref_name }}' -Replace "v(.*)", '$1'
|
||||||
& .\scripts\build_windows.ps1 buildApp
|
& .\scripts\build_windows.ps1 buildApp
|
||||||
|
@ -258,12 +263,12 @@ jobs:
|
||||||
echo "${{ vars.OLLAMA_CERT }}" >ollama_inc.crt
|
echo "${{ vars.OLLAMA_CERT }}" >ollama_inc.crt
|
||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: build-windows-*
|
pattern: build-windows-*
|
||||||
path: dist\
|
path: dist\
|
||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: depends-windows-amd64-*
|
pattern: depends-windows-amd64-*
|
||||||
path: dist\windows-amd64\
|
path: dist\windows-amd64\
|
||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
- run: |
|
- run: |
|
||||||
|
@ -294,8 +299,8 @@ jobs:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: docker/setup-buildx-action@v3
|
- uses: docker/setup-buildx-action@v3
|
||||||
- run: |
|
- run: |
|
||||||
apt-get update && apt-get install pigz
|
sudo apt-get update && sudo apt-get install pigz
|
||||||
for TARGET in ${{ matrix.targets }}; do docker buildx build --platform $PLATFORM --target $TARGET --build-arg GOFLAGS --build-arg CGO_CFLAGS --build-args CGO_CXXFLAGS --output type=local,dest=dist/$PLATFORM .; done
|
for TARGET in ${{ matrix.targets }}; do docker buildx build --platform $PLATFORM --target $TARGET --build-arg GOFLAGS --build-arg CGO_CFLAGS --build-arg CGO_CXXFLAGS --output type=local,dest=dist/$PLATFORM .; done
|
||||||
tar c -C dist/$PLATFORM . | pigz -9cv >dist/ollama-${PLATFORM//\//-}.tgz
|
tar c -C dist/$PLATFORM . | pigz -9cv >dist/ollama-${PLATFORM//\//-}.tgz
|
||||||
env:
|
env:
|
||||||
PLATFORM: ${{ matrix.os }}/${{ matrix.arch }}
|
PLATFORM: ${{ matrix.os }}/${{ matrix.arch }}
|
||||||
|
@ -371,20 +376,16 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
name: dist-darwin
|
||||||
path: dist
|
path: dist
|
||||||
pattern: dist-darwin
|
|
||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
name: dist-windows
|
||||||
path: dist
|
path: dist
|
||||||
pattern: dist-windows
|
|
||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
path: dist
|
|
||||||
pattern: dist-linux-*
|
pattern: dist-linux-*
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
path: dist
|
path: dist
|
||||||
pattern: dist-windows
|
|
||||||
- run: |
|
- run: |
|
||||||
ls -lh dist/
|
ls -lh dist/
|
||||||
(cd dist; find . -type f | xargs sha256sum > ../sha256sum.txt)
|
(cd dist; find . -type f | xargs sha256sum > ../sha256sum.txt)
|
||||||
|
|
|
@ -19,7 +19,7 @@ const config: ForgeConfig = {
|
||||||
icon: './assets/icon.icns',
|
icon: './assets/icon.icns',
|
||||||
extraResource: [
|
extraResource: [
|
||||||
path.join(__dirname, '../dist/darwin/ollama'),
|
path.join(__dirname, '../dist/darwin/ollama'),
|
||||||
...fs.readdirSync(path.join(__dirname, '../dist/darwin/amd64')).map(f => path.join(__dirname, '../dist/darwin/amd64', f)),
|
...fs.readdirSync(path.join(__dirname, '../dist/darwin-amd64/lib/ollama')).map(f => path.join(__dirname, '../dist/darwin-amd64/lib/ollama', f)),
|
||||||
path.join(__dirname, './assets/iconTemplate.png'),
|
path.join(__dirname, './assets/iconTemplate.png'),
|
||||||
path.join(__dirname, './assets/iconTemplate@2x.png'),
|
path.join(__dirname, './assets/iconTemplate@2x.png'),
|
||||||
path.join(__dirname, './assets/iconUpdateTemplate.png'),
|
path.join(__dirname, './assets/iconUpdateTemplate.png'),
|
||||||
|
|
|
@ -41,26 +41,24 @@ _build_darwin() {
|
||||||
|
|
||||||
_sign_darwin() {
|
_sign_darwin() {
|
||||||
status "Creating universal binary..."
|
status "Creating universal binary..."
|
||||||
lipo -create -output dist/darwin/ollama dist/darwin/*/ollama
|
mkdir -p dist/darwin
|
||||||
|
lipo -create -output dist/darwin/ollama dist/darwin-*/ollama
|
||||||
|
|
||||||
if [ -z "$APPLE_IDENTITY" ]; then
|
if [ -n "$APPLE_IDENTITY" ]; then
|
||||||
status "No APPLE_IDENTITY set, skipping code signing"
|
for F in dist/darwin/ollama dist/darwin-amd64/lib/ollama/*; do
|
||||||
return
|
codesign -f --timestamp -s "$APPLE_IDENTITY" --identifier ai.ollama.ollama --options=runtime $F
|
||||||
|
done
|
||||||
|
|
||||||
|
# create a temporary zip for notarization
|
||||||
|
TEMP=$(mktemp -u).zip
|
||||||
|
ditto -c -k --keepParent dist/darwin/ollama "$TEMP"
|
||||||
|
xcrun notarytool submit dist/darwin/temp.zip --wait --timeout 10m --apple-id $APPLE_ID --password $APPLE_PASSWORD --team-id $APPLE_TEAM_ID
|
||||||
|
rm -f "$TEMP"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for F in dist/darwin/ollama dist/darwin/amd64/lib*; do
|
status "Creating universal tarball..."
|
||||||
codesign -f --timestamp -s "$APPLE_IDENTITY" --identifier ai.ollama.ollama --options=runtime $F
|
|
||||||
done
|
|
||||||
|
|
||||||
# create a temporary zip for notarization
|
|
||||||
TEMP=$(mktemp -u).zip
|
|
||||||
ditto -c -k --keepParent dist/darwin/ollama "$TEMP"
|
|
||||||
xcrun notarytool submit dist/darwin/temp.zip --wait --timeout 10m --apple-id $APPLE_ID --password $APPLE_PASSWORD --team-id $APPLE_TEAM_ID
|
|
||||||
rm -f "$TEMP"
|
|
||||||
|
|
||||||
# create a universal tarball
|
|
||||||
tar -cf dist/ollama-darwin.tar --strip-components 2 dist/darwin/ollama
|
tar -cf dist/ollama-darwin.tar --strip-components 2 dist/darwin/ollama
|
||||||
tar -rf dist/ollama-darwin.tar --strip-components 3 dist/darwin/amd64/lib*
|
tar -rf dist/ollama-darwin.tar --strip-components 4 dist/darwin-amd64/lib/
|
||||||
gzip -9vc <dist/ollama-darwin.tar >dist/ollama-darwin.tgz
|
gzip -9vc <dist/ollama-darwin.tar >dist/ollama-darwin.tgz
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -208,8 +208,15 @@ function buildInstaller() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function distZip() {
|
function distZip() {
|
||||||
write-host "Generating stand-alone distribution zip file ${script:SRC_DIR}\dist\ollama-windows-${script:TARGET_ARCH}.zip"
|
if (Test-Path -Path "${script:SRC_DIR}\dist\windows-amd64") {
|
||||||
Compress-Archive -Path "${script:SRC_DIR}\dist\windows-${script:TARGET_ARCH}\*" -DestinationPath "${script:SRC_DIR}\dist\ollama-windows-${script:TARGET_ARCH}.zip" -Force
|
write-host "Generating stand-alone distribution zip file ${script:SRC_DIR}\dist\ollama-windows-amd64.zip"
|
||||||
|
Compress-Archive -Path "${script:SRC_DIR}\dist\windows-amd64\*" -DestinationPath "${script:SRC_DIR}\dist\ollama-windows-amd64.zip" -Force
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Test-Path -Path "${script:SRC_DIR}\dist\windows-arm64") {
|
||||||
|
write-host "Generating stand-alone distribution zip file ${script:SRC_DIR}\dist\ollama-windows-arm64.zip"
|
||||||
|
Compress-Archive -Path "${script:SRC_DIR}\dist\windows-arm64\*" -DestinationPath "${script:SRC_DIR}\dist\ollama-windows-arm64.zip" -Force
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
checkEnv
|
checkEnv
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue