diff --git a/.github/workflows/custom-image.yml b/.github/workflows/custom-image.yml new file mode 100644 index 0000000..5f6d4e7 --- /dev/null +++ b/.github/workflows/custom-image.yml @@ -0,0 +1,21 @@ +name: Start Redis server from a custom image + +on: [push, pull_request] + +jobs: + redis-action: + runs-on: ubuntu-latest + strategy: + matrix: + redis-version: [6.2.4-v4, 6.2.6-v3] + + name: Start Redis Stack Server v${{ matrix.redis-version }} + steps: + - name: Checkout + uses: actions/checkout@v1 + + - name: Start Redis Stack Server + uses: ./ + with: + redis-image: redis/redis-stack-server + redis-version: ${{ matrix.redis-version }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d0c66c..93c7f52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Changelog +## [1.5.0](https://github.com/superchargejs/redis-github-action/compare/v1i.4.0...v1.5.0) - 2023-02-xx + +### Added +- use a custom Redis image: useful if you need to run an alternative Redis image like Redis Stack + + ## [1.4.0](https://github.com/superchargejs/redis-github-action/compare/v1.3.0...v1.4.0) - 2021-12-28 ### Added diff --git a/README.md b/README.md index 69d01a0..5aab4e4 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ jobs: node-version: ${{ matrix.node-version }} - name: Start Redis - uses: supercharge/redis-github-action@1.4.0 + uses: supercharge/redis-github-action@1.5.0 with: redis-version: ${{ matrix.redis-version }} @@ -68,6 +68,33 @@ jobs: ``` +### Using a Custom Redis Image +You can utilize an alternative Redis image using the `redis-image` input: + +```yaml +name: Run tests + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [14.x, 16.x] + redis-version: [6.2.4-v4, 6.2.6-v3] + + steps: + - name: Start Redis + uses: supercharge/redis-github-action@1.5.0 + with: + redis-image: redis/redis-stack-server + redis-version: ${{ matrix.redis-version }} + + - name: … +``` + + ### Using Redis on a Custom Port You can start the Redis instance on a custom port using the `redis-port` input: @@ -86,7 +113,7 @@ jobs: steps: - name: Start Redis - uses: supercharge/redis-github-action@1.4.0 + uses: supercharge/redis-github-action@1.5.0 with: redis-version: ${{ matrix.redis-version }} redis-port: 12345 @@ -113,7 +140,7 @@ jobs: steps: - name: Start Redis - uses: supercharge/redis-github-action@1.4.0 + uses: supercharge/redis-github-action@1.5.0 with: redis-version: ${{ matrix.redis-version }} redis-container-name: redis-auth-token-cache diff --git a/action.yml b/action.yml index 4c77130..2b9bf7a 100644 --- a/action.yml +++ b/action.yml @@ -6,6 +6,10 @@ branding: color: 'red' inputs: + redis-image: + description: 'Redis image to use. Useful if you need to run a custom Redis image' + required: false + default: 'redis' redis-version: description: 'Redis version to use' required: false @@ -23,6 +27,7 @@ runs: using: 'docker' image: 'Dockerfile' args: + - ${{ inputs.redis-image }} - ${{ inputs.redis-version }} - ${{ inputs.redis-port }} - ${{ inputs.redis-container-name }} diff --git a/start-redis.sh b/start-redis.sh index 92f0822..7ddfcb8 100644 --- a/start-redis.sh +++ b/start-redis.sh @@ -1,8 +1,9 @@ #!/bin/sh -REDIS_VERSION=$1 -REDIS_PORT=$2 -REDIS_CONTAINER_NAME=$3 +REDIS_IMAGE=$1 +REDIS_VERSION=$2 +REDIS_PORT=$3 +REDIS_CONTAINER_NAME=$4 if [ -z "$REDIS_VERSION" ]; then echo "Missing Redis version in the [redis-version] input. Received value: $REDIS_VERSION" @@ -11,4 +12,4 @@ if [ -z "$REDIS_VERSION" ]; then fi echo "Starting single-node Redis instance" -docker run --name $REDIS_CONTAINER_NAME --publish $REDIS_PORT:6379 --detach redis:$REDIS_VERSION +docker run --name $REDIS_CONTAINER_NAME --publish $REDIS_PORT:6379 --detach $REDIS_IMAGE:$REDIS_VERSION