2019-11-25 17:27:15 +01:00
|
|
|
on:
|
2022-08-31 17:28:42 +02:00
|
|
|
schedule:
|
|
|
|
- cron: '0 2 * * *' # Every day at 2:00am
|
2020-07-21 14:39:12 +02:00
|
|
|
release:
|
|
|
|
types: [published]
|
|
|
|
|
|
|
|
name: Publish binaries to release
|
2019-11-25 17:27:15 +01:00
|
|
|
|
|
|
|
jobs:
|
2022-06-16 19:27:27 +02:00
|
|
|
check-version:
|
|
|
|
name: Check the version validity
|
|
|
|
runs-on: ubuntu-latest
|
2022-08-31 17:28:42 +02:00
|
|
|
# No need to check the version for dry run (cron)
|
2022-06-16 19:27:27 +02:00
|
|
|
steps:
|
2022-09-02 16:45:32 +02:00
|
|
|
- uses: actions/checkout@v3
|
2022-06-27 13:11:58 +02: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-09-01 13:34:34 +02:00
|
|
|
if: github.event_name != 'schedule'
|
2022-06-27 13:11:58 +02:00
|
|
|
id: check-tag-format
|
|
|
|
run: |
|
|
|
|
escaped_tag=$(printf "%q" ${{ github.ref_name }})
|
|
|
|
|
|
|
|
if [[ $escaped_tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
|
|
echo ::set-output name=stable::true
|
|
|
|
else
|
|
|
|
echo ::set-output name=stable::false
|
|
|
|
fi
|
2022-06-16 19:27:27 +02:00
|
|
|
- name: Check release validity
|
2022-09-01 13:34:34 +02:00
|
|
|
if: github.event_name != 'schedule' && steps.check-tag-format.outputs.stable == 'true'
|
2022-06-23 19:14:39 +02:00
|
|
|
run: bash .github/scripts/check-release.sh
|
2022-06-16 19:27:27 +02:00
|
|
|
|
2019-11-25 17:27:15 +01:00
|
|
|
publish:
|
2022-03-14 14:20:25 +01:00
|
|
|
name: Publish binary for ${{ matrix.os }}
|
2019-11-25 17:27:15 +01:00
|
|
|
runs-on: ${{ matrix.os }}
|
2022-06-16 19:27:27 +02:00
|
|
|
needs: check-version
|
2019-11-25 17:27:15 +01:00
|
|
|
strategy:
|
2021-12-08 09:42:58 +01:00
|
|
|
fail-fast: false
|
2019-11-25 17:27:15 +01:00
|
|
|
matrix:
|
2022-08-29 18:26:01 +02:00
|
|
|
os: [ubuntu-20.04, macos-latest, windows-latest]
|
2019-11-25 17:27:15 +01:00
|
|
|
include:
|
2022-08-29 18:26:01 +02:00
|
|
|
- os: ubuntu-20.04
|
2019-11-26 11:17:30 +01:00
|
|
|
artifact_name: meilisearch
|
|
|
|
asset_name: meilisearch-linux-amd64
|
2019-11-25 17:27:15 +01:00
|
|
|
- os: macos-latest
|
2019-11-26 11:17:30 +01:00
|
|
|
artifact_name: meilisearch
|
|
|
|
asset_name: meilisearch-macos-amd64
|
2019-12-07 11:52:14 +01:00
|
|
|
- os: windows-latest
|
2020-05-11 18:15:01 +02:00
|
|
|
artifact_name: meilisearch.exe
|
|
|
|
asset_name: meilisearch-windows-amd64.exe
|
2019-11-25 17:27:15 +01:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: hecrj/setup-rust-action@master
|
|
|
|
with:
|
|
|
|
rust-version: stable
|
2022-06-28 22:21:41 +02:00
|
|
|
- uses: actions/checkout@v3
|
2019-11-25 17:27:15 +01:00
|
|
|
- name: Build
|
|
|
|
run: cargo build --release --locked
|
2022-08-31 17:28:42 +02:00
|
|
|
# No need to upload binaries for dry run (cron)
|
2019-11-25 17:27:15 +01:00
|
|
|
- name: Upload binaries to release
|
2022-08-31 17:28:42 +02:00
|
|
|
if: github.event_name != 'schedule'
|
2019-11-25 17:27:15 +01:00
|
|
|
uses: svenstaro/upload-release-action@v1-release
|
|
|
|
with:
|
2022-09-04 11:32:22 +02:00
|
|
|
repo_token: ${{ secrets.MEILI_BOT_GH_PAT }}
|
2019-11-25 17:27:15 +01:00
|
|
|
file: target/release/${{ matrix.artifact_name }}
|
|
|
|
asset_name: ${{ matrix.asset_name }}
|
|
|
|
tag: ${{ github.ref }}
|
2020-03-25 13:50:17 +01:00
|
|
|
|
2022-02-02 19:25:28 +01:00
|
|
|
publish-aarch64:
|
2022-03-14 14:20:25 +01:00
|
|
|
name: Publish binary for aarch64
|
2022-02-02 19:25:28 +01:00
|
|
|
runs-on: ${{ matrix.os }}
|
2022-06-16 19:27:27 +02:00
|
|
|
needs: check-version
|
2022-02-02 19:25:28 +01:00
|
|
|
continue-on-error: false
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- build: aarch64
|
2022-08-29 18:26:01 +02:00
|
|
|
os: ubuntu-20.04
|
2022-02-02 19:25:28 +01:00
|
|
|
target: aarch64-unknown-linux-gnu
|
|
|
|
linker: gcc-aarch64-linux-gnu
|
|
|
|
use-cross: true
|
|
|
|
asset_name: meilisearch-linux-aarch64
|
|
|
|
|
2020-04-03 10:39:28 +02:00
|
|
|
steps:
|
2022-02-02 19:25:28 +01:00
|
|
|
- name: Checkout repository
|
2022-06-28 22:21:41 +02:00
|
|
|
uses: actions/checkout@v3
|
2022-02-02 19:25:28 +01:00
|
|
|
|
|
|
|
- name: Installing Rust toolchain
|
|
|
|
uses: actions-rs/toolchain@v1
|
2020-04-03 10:39:28 +02:00
|
|
|
with:
|
2022-02-02 19:25:28 +01:00
|
|
|
toolchain: stable
|
|
|
|
profile: minimal
|
|
|
|
target: ${{ matrix.target }}
|
|
|
|
override: true
|
|
|
|
|
|
|
|
- name: APT update
|
|
|
|
run: |
|
|
|
|
sudo apt update
|
|
|
|
|
|
|
|
- name: Install target specific tools
|
|
|
|
if: matrix.use-cross
|
|
|
|
run: |
|
|
|
|
sudo apt-get install -y ${{ matrix.linker }}
|
|
|
|
|
|
|
|
- name: Configure target aarch64 GNU
|
|
|
|
if: matrix.target == 'aarch64-unknown-linux-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
|
|
|
|
echo RUSTFLAGS="-Clink-arg=-fuse-ld=gold" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Cargo build
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: build
|
|
|
|
use-cross: ${{ matrix.use-cross }}
|
|
|
|
args: --release --target ${{ matrix.target }}
|
|
|
|
|
|
|
|
- name: List target output files
|
|
|
|
run: ls -lR ./target
|
|
|
|
|
2020-04-03 10:39:28 +02:00
|
|
|
- name: Upload the binary to release
|
2022-08-31 17:28:42 +02:00
|
|
|
# No need to upload binaries for dry run (cron)
|
|
|
|
if: github.event_name != 'schedule'
|
2020-04-03 10:39:28 +02:00
|
|
|
uses: svenstaro/upload-release-action@v1-release
|
|
|
|
with:
|
2022-09-04 11:32:22 +02:00
|
|
|
repo_token: ${{ secrets.MEILI_BOT_GH_PAT }}
|
2022-02-02 19:25:28 +01:00
|
|
|
file: target/${{ matrix.target }}/release/meilisearch
|
|
|
|
asset_name: ${{ matrix.asset_name }}
|
2020-04-03 10:39:28 +02:00
|
|
|
tag: ${{ github.ref }}
|