Skip to content

Commit

Permalink
Add Meilisearch setup action
Browse files Browse the repository at this point in the history
```yaml
steps:
      - name: Set up Meilisearch
        uses: wabarc/.github/.github/meilisearch@main
```
  • Loading branch information
waybackarchiver authored Feb 19, 2024
1 parent dbe0a0e commit b3f64ba
Showing 1 changed file with 108 additions and 0 deletions.
108 changes: 108 additions & 0 deletions .github/meilisearch/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: "Set up Meilisearch"
author: "Wayback Archiver"
description: "A composite action that set up Meilisearch"

inputs:
version:
description: "The version of Meilisearch, e.g. 1.6.2"
required: false
default: ""
master-key:
description: "The master key of Meilisearch"
required: false
default: ""
port:
description: "The port of Meilisearch"
required: false
default: "7700"

outputs:
version:
description: "The installed version of Meilisearch."
value: ${{ steps.prepare.outputs.version }}

runs:
using: composite
steps:
- name: Prepare
id: prepare
shell: bash
run: |
if [ -n "$INPUT_VERSION" ]; then
VERSION="v$INPUT_VERSION"
else
VERSION=$(curl -sL -H user-agent:github-runner https://api.github.com/repos/meilisearch/meilisearch/releases/latest | jq -r ".tag_name")
fi
echo "version=$(echo $VERSION)" >> $GITHUB_OUTPUT
env:
INPUT_VERSION: ${{ inputs.version }}

- name: Download binary
shell: bash
if: runner.os == 'Linux'
run: |
echo ::group::Download binary
rm -f "$RUNNER_TEMP/meilisearch"
URL="https://github.com/meilisearch/meilisearch/releases/download/$VERSION/meilisearch-linux-amd64"
curl -H user-agent:github-runner -L "$URL" -o "$RUNNER_TEMP/meilisearch" --max-time 300
echo ::endgroup::
env:
VERSION: ${{ steps.prepare.outputs.version }}

- name: Download binary
shell: bash
if: runner.os == 'macOS'
run: |
echo ::group::Download binary
rm -f "$RUNNER_TEMP/meilisearch"
URL="https://github.com/meilisearch/meilisearch/releases/download/$VERSION/meilisearch-macos-amd64"
curl -H user-agent:github-runner -L "$URL" -o "$RUNNER_TEMP/meilisearch" --max-time 300
echo ::endgroup::
env:
VERSION: ${{ steps.prepare.outputs.version }}

- name: Download binary
shell: bash
if: runner.os == 'Windows'
run: |
echo ::group::Download binary
rm -f "$RUNNER_TEMP\meilisearch.exe"
URL="https://github.com/meilisearch/meilisearch/releases/download/$VERSION/meilisearch-windows-amd64.exe"
curl -H user-agent:github-runner -L "$URL" -o "$RUNNER_TEMP\meilisearch.exe" --max-time 300
echo ::endgroup::
env:
VERSION: ${{ steps.prepare.outputs.version }}

- name: Launch Meilisearch
shell: bash
if: runner.os != 'Windows'
run: |
echo ::group::Launch Meilisearch
ADDRESS="0.0.0.0:$MEILISEARCH_PORT"
chmod a+rx "$RUNNER_TEMP/meilisearch"
"$RUNNER_TEMP/meilisearch" --http-addr "$ADDRESS" &> /dev/stderr &
echo "address=$(echo $ADDRESS)" >> $GITHUB_OUTPUT
echo ::endgroup::
env:
MEILI_MASTER_KEY: ${{ inputs.master-key }}
MEILISEARCH_PORT: ${{ inputs.port }}
MEILI_NO_ANALYTICS: true

- name: Launch Meilisearch
shell: bash
if: runner.os == 'Windows'
run: |
echo ::group::Launch Meilisearch
ADDRESS="0.0.0.0:$MEILISEARCH_PORT"
START /MIN "$RUNNER_TEMP\meilisearch.exe" --http-addr "$ADDRESS" &> "$RUNNER_TEMP\meilisearch.out" &
START powershell -c Get-Content "$RUNNER_TEMP\meilisearch.out" -Wait
echo "address=$(echo $ADDRESS)" >> $GITHUB_OUTPUT
echo ::endgroup::
env:
MEILI_MASTER_KEY: ${{ inputs.master-key }}
MEILISEARCH_PORT: ${{ inputs.port }}
MEILI_NO_ANALYTICS: true

branding:
icon: 'life-buoy'
color: 'pink'

0 comments on commit b3f64ba

Please sign in to comment.