initial commit

This commit is contained in:
Raymond Tukpe
2022-08-16 15:04:08 +01:00
commit b5b790e84f
7 changed files with 139 additions and 0 deletions

21
.github/workflows/container-name.yml vendored Normal file
View File

@@ -0,0 +1,21 @@
name: Start Typesense server with custom container name
on: [push, pull_request]
jobs:
typesense-action:
runs-on: ubuntu-latest
strategy:
matrix:
typesense-version: [0.23.1]
name: Start Typesense Server v${{ matrix.typesense-version }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Start Typesense Server
uses: ./
with:
typesense-version: ${{ matrix.typesense-version }}
typesense-container-name: typesense-auth-token-cache

21
.github/workflows/custom-port.yml vendored Normal file
View File

@@ -0,0 +1,21 @@
name: Start typesense server on custom port
on: [push, pull_request]
jobs:
typesense-action:
runs-on: ubuntu-latest
strategy:
matrix:
typesense-version: [0.23.1]
name: Start typesense Server v${{ matrix.typesense-version }}
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Start typesense Server
uses: ./
with:
typesense-version: ${{ matrix.typesense-version }}
typesense-port: 12345

View File

@@ -0,0 +1,17 @@
name: Start Typesense server with latest version
on: [push, pull_request]
jobs:
typesense-action:
runs-on: ubuntu-latest
name: Start Typesense Server with latest Typesense version
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Start Typesense Server
uses: ./
with:
typesense-version: ${{ matrix.typesense-versions }}

20
.github/workflows/main.yml vendored Normal file
View File

@@ -0,0 +1,20 @@
name: Start Typesense server
on: [push, pull_request]
jobs:
typesense-action:
runs-on: ubuntu-latest
strategy:
matrix:
typesense-version: [0.23.1]
name: Start Typesense Server v${{ matrix.typesense-version }}
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Start Typesense Server
uses: ./
with:
typesense-version: ${{ matrix.typesense-version }}

4
Dockerfile Normal file
View File

@@ -0,0 +1,4 @@
FROM docker:stable
COPY start-typesense.sh /start-typesense.sh
RUN chmod +x /start-typesense.sh
ENTRYPOINT ["/start-typesense.sh"]

33
action.yml Normal file
View File

@@ -0,0 +1,33 @@
name: "Typesense Server in GitHub Actions"
description: "Start a Typesense server"
branding:
icon: "search"
color: "red"
inputs:
typesense-version:
description: "typesense version to use"
required: false
default: "0.23.1"
typesense-port:
description: "typesense port to use and expose"
required: false
default: 8108
typesense-container-name:
description: "Name of the created container. Useful if you run multiple typesense containers"
required: false
default: "typesense"
typesense-api-key:
description: "typesense api key"
required: false
default: "typesense"
runs:
using: "docker"
image: "Dockerfile"
args:
- ${{ inputs.typesense-version }}
- ${{ inputs.typesense-port }}
- ${{ inputs.typesense-container-name }}
- ${{ inputs.typesense-api-key }}

23
start-typesense.sh Normal file
View File

@@ -0,0 +1,23 @@
#!/bin/sh
TYPESENSE_VERSION=$1
TYPESENSE_PORT=$2
TYPESENSE_CONTAINER_NAME=$3
TYPESENSE_API_KEY=$4
if [ -z "$TYPESENSE_VERSION" ]; then
echo "Missing Typesense version in the [typesense-version] input. Received value: $TYPESENSE_VERSION"
echo "Falling back to Typesense version [0.23.1]"
TYPESENSE_VERSION='0.23.1'
fi
echo "Starting single-node Typesense instance"
# mkdir /tmp/typesense-data
docker run -d \
-p $TYPESENSE_PORT:8108 \
# -v/tmp/typesense-data:/data \
--name $TYPESENSE_CONTAINER_NAME \
typesense/typesense:$TYPESENSE_VERSION \
# --data-dir /data \
--api-key=$TYPESENSE_API_KEY \
--enable-cors