2023-03-07 21:55:09 +08:00
|
|
|
name: Publish binaries to GitHub release
|
|
|
|
|
2019-11-26 00:27:15 +08:00
|
|
|
on:
|
2022-11-22 01:05:57 +08:00
|
|
|
workflow_dispatch:
|
2022-08-31 23:28:42 +08:00
|
|
|
schedule:
|
|
|
|
- cron: '0 2 * * *' # Every day at 2:00am
|
2020-07-21 20:39:12 +08:00
|
|
|
release:
|
|
|
|
types: [published]
|
|
|
|
|
2019-11-26 00:27:15 +08:00
|
|
|
jobs:
|
2022-06-17 01:27:27 +08:00
|
|
|
check-version:
|
|
|
|
name: Check the version validity
|
|
|
|
runs-on: ubuntu-latest
|
2022-08-31 23:28:42 +08:00
|
|
|
# No need to check the version for dry run (cron)
|
2022-06-17 01:27:27 +08:00
|
|
|
steps:
|
2022-09-02 22:45:32 +08:00
|
|
|
- uses: actions/checkout@v3
|
2022-06-27 19:11:58 +08:00
|
|
|
# Check if the tag has the v<nmumber>.<number>.<number> format.
|
|
|
|
# If yes, it means we are publishing an official release.
|
|
|
|
# If no, we are releasing a RC, so no need to check the version.
|
|
|
|
- name: Check tag format
|
2022-11-28 23:27:41 +08:00
|
|
|
if: github.event_name == 'release'
|
2022-06-27 19:11:58 +08:00
|
|
|
id: check-tag-format
|
|
|
|
run: |
|
|
|
|
escaped_tag=$(printf "%q" ${{ github.ref_name }})
|
|
|
|
|
|
|
|
if [[ $escaped_tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
2022-11-10 17:40:09 +08:00
|
|
|
echo "stable=true" >> $GITHUB_OUTPUT
|
2022-06-27 19:11:58 +08:00
|
|
|
else
|
2022-11-10 17:40:04 +08:00
|
|
|
echo "stable=false" >> $GITHUB_OUTPUT
|
2022-06-27 19:11:58 +08:00
|
|
|
fi
|
2022-06-17 01:27:27 +08:00
|
|
|
- name: Check release validity
|
2022-11-28 23:27:41 +08:00
|
|
|
if: github.event_name == 'release' && steps.check-tag-format.outputs.stable == 'true'
|
2022-06-24 01:14:39 +08:00
|
|
|
run: bash .github/scripts/check-release.sh
|
2022-06-17 01:27:27 +08:00
|
|
|
|
2022-12-20 01:35:33 +08:00
|
|
|
publish-linux:
|
|
|
|
name: Publish binary for Linux
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: check-version
|
|
|
|
container:
|
2022-12-20 01:46:27 +08:00
|
|
|
# Use ubuntu-18.04 to compile with glibc 2.27
|
2022-12-20 01:35:33 +08:00
|
|
|
image: ubuntu:18.04
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Install needed dependencies
|
|
|
|
run: |
|
|
|
|
apt-get update && apt-get install -y curl
|
|
|
|
apt-get install build-essential -y
|
2024-06-25 23:00:50 +08:00
|
|
|
- uses: helix-editor/rust-toolchain@v1
|
2022-12-20 01:35:33 +08:00
|
|
|
- name: Build
|
|
|
|
run: cargo build --release --locked
|
|
|
|
# No need to upload binaries for dry run (cron)
|
|
|
|
- name: Upload binaries to release
|
|
|
|
if: github.event_name == 'release'
|
2023-08-02 01:22:37 +08:00
|
|
|
uses: svenstaro/upload-release-action@2.7.0
|
2022-12-20 01:35:33 +08:00
|
|
|
with:
|
|
|
|
repo_token: ${{ secrets.MEILI_BOT_GH_PAT }}
|
|
|
|
file: target/release/meilisearch
|
|
|
|
asset_name: meilisearch-linux-amd64
|
|
|
|
tag: ${{ github.ref }}
|
|
|
|
|
|
|
|
publish-macos-windows:
|
2022-03-14 21:20:25 +08:00
|
|
|
name: Publish binary for ${{ matrix.os }}
|
2019-11-26 00:27:15 +08:00
|
|
|
runs-on: ${{ matrix.os }}
|
2022-06-17 01:27:27 +08:00
|
|
|
needs: check-version
|
2019-11-26 00:27:15 +08:00
|
|
|
strategy:
|
2021-12-08 16:42:58 +08:00
|
|
|
fail-fast: false
|
2019-11-26 00:27:15 +08:00
|
|
|
matrix:
|
2022-12-20 18:10:09 +08:00
|
|
|
os: [macos-12, windows-2022]
|
2019-11-26 00:27:15 +08:00
|
|
|
include:
|
2022-12-20 18:10:09 +08:00
|
|
|
- os: macos-12
|
2019-11-26 18:17:30 +08:00
|
|
|
artifact_name: meilisearch
|
|
|
|
asset_name: meilisearch-macos-amd64
|
2022-12-20 18:10:09 +08:00
|
|
|
- os: windows-2022
|
2020-05-12 00:15:01 +08:00
|
|
|
artifact_name: meilisearch.exe
|
|
|
|
asset_name: meilisearch-windows-amd64.exe
|
2019-11-26 00:27:15 +08:00
|
|
|
steps:
|
2022-06-29 04:21:41 +08:00
|
|
|
- uses: actions/checkout@v3
|
2024-06-25 23:00:50 +08:00
|
|
|
- uses: helix-editor/rust-toolchain@v1
|
2019-11-26 00:27:15 +08:00
|
|
|
- name: Build
|
|
|
|
run: cargo build --release --locked
|
2022-08-31 23:28:42 +08:00
|
|
|
# No need to upload binaries for dry run (cron)
|
2019-11-26 00:27:15 +08:00
|
|
|
- name: Upload binaries to release
|
2022-11-28 23:27:41 +08:00
|
|
|
if: github.event_name == 'release'
|
2023-08-02 01:22:37 +08:00
|
|
|
uses: svenstaro/upload-release-action@2.7.0
|
2019-11-26 00:27:15 +08:00
|
|
|
with:
|
2022-09-04 17:32:22 +08:00
|
|
|
repo_token: ${{ secrets.MEILI_BOT_GH_PAT }}
|
2019-11-26 00:27:15 +08:00
|
|
|
file: target/release/${{ matrix.artifact_name }}
|
|
|
|
asset_name: ${{ matrix.asset_name }}
|
|
|
|
tag: ${{ github.ref }}
|
2022-11-01 05:23:16 +08:00
|
|
|
|
2022-10-03 21:09:39 +08:00
|
|
|
publish-macos-apple-silicon:
|
|
|
|
name: Publish binary for macOS silicon
|
2023-03-08 00:25:39 +08:00
|
|
|
runs-on: macos-12
|
2022-10-03 21:09:39 +08:00
|
|
|
needs: check-version
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
2023-03-08 00:25:39 +08:00
|
|
|
- target: aarch64-apple-darwin
|
2022-10-03 21:09:39 +08:00
|
|
|
asset_name: meilisearch-macos-apple-silicon
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Installing Rust toolchain
|
2024-06-25 23:00:50 +08:00
|
|
|
uses: helix-editor/rust-toolchain@v1
|
2022-10-03 21:09:39 +08:00
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
target: ${{ matrix.target }}
|
|
|
|
- name: Cargo build
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: build
|
|
|
|
args: --release --target ${{ matrix.target }}
|
|
|
|
- name: Upload the binary to release
|
|
|
|
# No need to upload binaries for dry run (cron)
|
2022-11-28 23:27:41 +08:00
|
|
|
if: github.event_name == 'release'
|
2023-08-02 01:22:37 +08:00
|
|
|
uses: svenstaro/upload-release-action@2.7.0
|
2022-10-03 21:09:39 +08:00
|
|
|
with:
|
|
|
|
repo_token: ${{ secrets.MEILI_BOT_GH_PAT }}
|
|
|
|
file: target/${{ matrix.target }}/release/meilisearch
|
|
|
|
asset_name: ${{ matrix.asset_name }}
|
|
|
|
tag: ${{ github.ref }}
|
2020-03-25 20:50:17 +08:00
|
|
|
|
2022-02-03 02:25:28 +08:00
|
|
|
publish-aarch64:
|
2022-03-14 21:20:25 +08:00
|
|
|
name: Publish binary for aarch64
|
2023-03-08 00:25:39 +08:00
|
|
|
runs-on: ubuntu-latest
|
2022-06-17 01:27:27 +08:00
|
|
|
needs: check-version
|
2023-03-08 00:25:39 +08:00
|
|
|
container:
|
|
|
|
# Use ubuntu-18.04 to compile with glibc 2.27
|
|
|
|
image: ubuntu:18.04
|
2022-02-03 02:25:28 +08:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
2023-03-08 00:25:39 +08:00
|
|
|
- target: aarch64-unknown-linux-gnu
|
2022-02-03 02:25:28 +08:00
|
|
|
asset_name: meilisearch-linux-aarch64
|
2020-04-03 16:39:28 +08:00
|
|
|
steps:
|
2022-02-03 02:25:28 +08:00
|
|
|
- name: Checkout repository
|
2022-06-29 04:21:41 +08:00
|
|
|
uses: actions/checkout@v3
|
2023-03-08 00:25:39 +08:00
|
|
|
- name: Install needed dependencies
|
|
|
|
run: |
|
|
|
|
apt-get update -y && apt upgrade -y
|
|
|
|
apt-get install -y curl build-essential gcc-aarch64-linux-gnu
|
|
|
|
- name: Set up Docker for cross compilation
|
|
|
|
run: |
|
|
|
|
apt-get install -y curl apt-transport-https ca-certificates software-properties-common
|
|
|
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
|
|
|
|
add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
|
|
|
|
apt-get update -y && apt-get install -y docker-ce
|
2022-02-03 02:25:28 +08:00
|
|
|
- name: Installing Rust toolchain
|
2024-06-25 23:00:50 +08:00
|
|
|
uses: helix-editor/rust-toolchain@v1
|
2020-04-03 16:39:28 +08:00
|
|
|
with:
|
2022-02-03 02:25:28 +08:00
|
|
|
profile: minimal
|
|
|
|
target: ${{ matrix.target }}
|
|
|
|
- name: Configure target aarch64 GNU
|
|
|
|
## Environment variable is not passed using env:
|
|
|
|
## LD gold won't work with MUSL
|
|
|
|
# env:
|
|
|
|
# JEMALLOC_SYS_WITH_LG_PAGE: 16
|
|
|
|
# RUSTFLAGS: '-Clink-arg=-fuse-ld=gold'
|
|
|
|
run: |
|
|
|
|
echo '[target.aarch64-unknown-linux-gnu]' >> ~/.cargo/config
|
|
|
|
echo 'linker = "aarch64-linux-gnu-gcc"' >> ~/.cargo/config
|
|
|
|
echo 'JEMALLOC_SYS_WITH_LG_PAGE=16' >> $GITHUB_ENV
|
|
|
|
- name: Cargo build
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: build
|
2023-03-08 00:25:39 +08:00
|
|
|
use-cross: true
|
2022-02-03 02:25:28 +08:00
|
|
|
args: --release --target ${{ matrix.target }}
|
2023-03-08 00:25:39 +08:00
|
|
|
env:
|
|
|
|
CROSS_DOCKER_IN_DOCKER: true
|
2022-02-03 02:25:28 +08:00
|
|
|
- name: List target output files
|
|
|
|
run: ls -lR ./target
|
2020-04-03 16:39:28 +08:00
|
|
|
- name: Upload the binary to release
|
2022-08-31 23:28:42 +08:00
|
|
|
# No need to upload binaries for dry run (cron)
|
2022-11-28 23:27:41 +08:00
|
|
|
if: github.event_name == 'release'
|
2023-08-02 01:22:37 +08:00
|
|
|
uses: svenstaro/upload-release-action@2.7.0
|
2020-04-03 16:39:28 +08:00
|
|
|
with:
|
2022-09-04 17:32:22 +08:00
|
|
|
repo_token: ${{ secrets.MEILI_BOT_GH_PAT }}
|
2022-02-03 02:25:28 +08:00
|
|
|
file: target/${{ matrix.target }}/release/meilisearch
|
|
|
|
asset_name: ${{ matrix.asset_name }}
|
2020-04-03 16:39:28 +08:00
|
|
|
tag: ${{ github.ref }}
|