Skip to content

Commit 3b909ab

Browse files
authored
Build and publish binaries (#116)
* add build exe workflow file * install openssl * fix typo * convert openssl step to bash * set openssl env-vars * use choco install for windows packages * add openssl envs to build step * add openssl paths to matrix for each os/arch * add openssl_dir * fix typo * add PKG_CONFIG_PATH * fix typo * use choco install for windows packages * build cargo withour actions-rs * install gcc-aarch64-linux-gnu * openssl_dir as /usr/local/ssl * actions-rs use-cross * use houseabsolute/actions-rust-cross * build for macos/linux * build for macos arm64 * build for macos amd64 * build for macos and linux * update latest release with assets * build windows-amd64 * build windows-arm64 * use nightly for windows-arm64 * build linux-arm64 with prebuilt openssl installation * use linker rust-lld * add exes to v0.2.0 * update ollama-workflows * fix typo * remove linker * build for macos and linux all archs * ollama update * tar.gz instead of zip * change asset names * publish exe instead of tar * publish binaries for macos and linux * windows build * fix typo * trigger workflow on release creation
1 parent 143dc3e commit 3b909ab

File tree

2 files changed

+98
-0
lines changed

2 files changed

+98
-0
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Build and Publish Compute Releases
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
12+
build:
13+
runs-on: ${{ matrix.runner }}
14+
strategy:
15+
matrix:
16+
include:
17+
- { runner: macos-latest, osname: macOS, arch: amd64, target: x86_64-apple-darwin, command: build }
18+
- { runner: macos-latest, osname: macOS, arch: arm64, target: aarch64-apple-darwin, command: build }
19+
- { runner: ubuntu-latest, osname: linux, arch: amd64, target: x86_64-unknown-linux-gnu, command: build }
20+
- { runner: ubuntu-latest, osname: linux, arch: arm64, target: aarch64-unknown-linux-gnu, command: build, build_args: --no-default-features }
21+
- { runner: windows-latest, osname: windows, arch: amd64, target: x86_64-pc-windows-msvc, command: build, extension: ".exe" }
22+
# - { runner: windows-latest, osname: windows, arch: arm64, target: aarch64-pc-windows-msvc, command: build, extension: ".exe", toolchain: nightly }
23+
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v3
27+
28+
- name: Get the release version from the tag
29+
shell: bash
30+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
31+
32+
- name: Build binary
33+
uses: houseabsolute/actions-rust-cross@v0
34+
with:
35+
command: ${{ matrix.command }}
36+
target: ${{ matrix.target }}
37+
args: "--locked --release ${{ matrix.build_args }}"
38+
strip: true
39+
40+
- name: Prepare Release File
41+
run: |
42+
# move the binary
43+
mv target/${{ matrix.target }}/release/dkn-compute${{ matrix.extension }} ./dkn-compute-binary-${{ matrix.osname }}-${{ matrix.arch }}${{ matrix.extension }}
44+
45+
46+
- name: Upload Launch Artifacts
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: dkn-compute-binary-${{ matrix.osname }}-${{ matrix.arch }}
50+
path: dkn-compute-binary-${{ matrix.osname }}-${{ matrix.arch }}${{ matrix.extension }}
51+
52+
53+
release:
54+
needs: build
55+
runs-on: ubuntu-latest
56+
57+
steps:
58+
- name: Checkout code
59+
uses: actions/checkout@v3
60+
with:
61+
fetch-depth: 0 # Fetch all tags and history
62+
63+
- name: Download Launch Artifacts
64+
uses: actions/download-artifact@v4
65+
with:
66+
merge-multiple: true
67+
path: ./artifacts
68+
69+
- name: Get the latest tag
70+
id: get_latest_tag
71+
run: |
72+
# latest release tag
73+
LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1) 2>/dev/null || echo "untagged")
74+
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
75+
76+
# latest release name
77+
LATEST_RELEASE=$(curl -s \
78+
-H "Accept: application/vnd.github.v3+json" \
79+
https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.name // "no-release-found"')
80+
echo "LATEST_RELEASE=$LATEST_RELEASE" >> $GITHUB_ENV
81+
82+
echo "Latest Tag: $LATEST_TAG"
83+
echo "Latest Release: $LATEST_RELEASE"
84+
85+
- name: Create release with artifacts
86+
uses: ncipollo/release-action@v1
87+
with:
88+
name: ${{ env.LATEST_RELEASE }}
89+
tag: ${{ env.LATEST_TAG }}
90+
artifacts: "artifacts/*"
91+
artifactContentType: application/octet-stream
92+
allowUpdates: true
93+
# draft: true

Cross.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[target.aarch64-unknown-linux-gnu]
2+
pre-build = [
3+
"dpkg --add-architecture $CROSS_DEB_ARCH",
4+
"apt-get update && apt-get install --assume-yes libssl-dev:$CROSS_DEB_ARCH"
5+
]

0 commit comments

Comments
 (0)