feat: add redis auth
parent
ce7e9aba46
commit
7992bfbe98
|
@ -0,0 +1,21 @@
|
|||
name: Start Redis server with Authentication
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
redis-action:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
redis-version: [4, 5, 6]
|
||||
|
||||
name: Start Redis Server v${{ matrix.redis-version }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- name: Start Redis Server
|
||||
uses: ./
|
||||
with:
|
||||
redis-version: ${{ matrix.redis-version }}
|
||||
redis-password: password
|
|
@ -1,5 +1,12 @@
|
|||
# Changelog
|
||||
|
||||
## [1.7.0](https://github.com/supercharge/redis-github-action/compare/v1.6.0...v1.7.0) - 2023-08-12
|
||||
|
||||
### Added
|
||||
- add `redis-password` for start Redis with Authentication
|
||||
|
||||
### Updated
|
||||
- update versions in README
|
||||
|
||||
## [1.6.0](https://github.com/supercharge/redis-github-action/compare/v1.5.0...v1.6.0) - 2023-07-27
|
||||
|
||||
|
|
24
README.md
24
README.md
|
@ -170,6 +170,30 @@ jobs:
|
|||
- name: …
|
||||
```
|
||||
|
||||
### Using Authentication
|
||||
Starting in v1.7.0, You can start the Redis with Authentication using the `redis-password` input:
|
||||
|
||||
```yaml
|
||||
name: Run tests
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
redis-version: [6, 7]
|
||||
|
||||
steps:
|
||||
- name: Start Redis
|
||||
uses: supercharge/redis-github-action@1.6.0
|
||||
with:
|
||||
redis-version: ${{ matrix.redis-version }}
|
||||
redis-password: 'password'
|
||||
|
||||
- name: …
|
||||
```
|
||||
|
||||
## License
|
||||
MIT © [Supercharge](https://superchargejs.com)
|
||||
|
|
|
@ -18,6 +18,10 @@ inputs:
|
|||
description: 'Redis port to use and expose'
|
||||
required: false
|
||||
default: 6379
|
||||
redis-password:
|
||||
description: "Redis password to use"
|
||||
required: false
|
||||
default: ''
|
||||
redis-container-name:
|
||||
description: "Name of the created container. Useful if you run multiple Redis containers"
|
||||
required: false
|
||||
|
@ -35,5 +39,6 @@ runs:
|
|||
- ${{ inputs.redis-image }}
|
||||
- ${{ inputs.redis-version }}
|
||||
- ${{ inputs.redis-port }}
|
||||
- ${{ inputs.redis-password }}
|
||||
- ${{ inputs.redis-container-name }}
|
||||
- ${{ inputs.redis-remove-container }}
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
REDIS_IMAGE=$1
|
||||
REDIS_VERSION=$2
|
||||
REDIS_PORT=$3
|
||||
REDIS_CONTAINER_NAME=$4
|
||||
REDIS_REMOVE_CONTAINER=$5
|
||||
REDIS_PASSWORD=$4
|
||||
REDIS_CONTAINER_NAME=$5
|
||||
REDIS_REMOVE_CONTAINER=$6
|
||||
|
||||
if [ -z "$REDIS_VERSION" ]; then
|
||||
echo "Missing Redis version in the [redis-version] input. Received value: $REDIS_VERSION"
|
||||
|
@ -14,8 +15,12 @@ fi
|
|||
|
||||
DOCKER_RUN_ARGS="--name $REDIS_CONTAINER_NAME --publish $REDIS_PORT:6379 --detach $REDIS_IMAGE:$REDIS_VERSION"
|
||||
|
||||
if [ -n "$REDIS_PASSWORD" ] ; then
|
||||
DOCKER_RUN_ARGS="$DOCKER_RUN_ARGS redis-server --requirepass $REDIS_PASSWORD"
|
||||
fi
|
||||
|
||||
if [ "$REDIS_REMOVE_CONTAINER" == "true" ] ; then
|
||||
DOCKER_RUN_ARGS+=" --rm"
|
||||
DOCKER_RUN_ARGS="$DOCKER_RUN_ARGS --rm"
|
||||
fi
|
||||
|
||||
echo "Starting single-node Redis instance: $DOCKER_RUN_ARGS"
|
||||
|
|
Loading…
Reference in New Issue