feat: add support for compose env variables (#9)

Co-authored-by: Emilien Escalle <emilien.escalle@escemi.com>
This commit is contained in:
Emilien Escalle 2022-10-05 09:36:36 +02:00 committed by GitHub
parent 234ccc8f01
commit f11945c961
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 1 deletions

View File

@ -25,6 +25,11 @@ jobs:
compose-file: "./docker/docker-compose.yml" compose-file: "./docker/docker-compose.yml"
compose-flags: "--profile profile-1" compose-flags: "--profile profile-1"
down-flags: "--volumes" down-flags: "--volumes"
- uses: ./
with:
compose-file: "./docker/docker-compose-with-env.yml"
env:
IMAGE_NAME: hello-world
- uses: ./ - uses: ./
with: with:
compose-file: | compose-file: |
@ -32,4 +37,4 @@ jobs:
./docker/docker-compose.ci.yml ./docker/docker-compose.ci.yml
services: | services: |
helloworld2 helloworld2
helloworld4 helloworld4

View File

@ -46,3 +46,15 @@ steps:
helloworld2 helloworld2
helloworld3 helloworld3
``` ```
### Using environment variables
```yaml
steps:
- uses: actions/checkout@v3
- uses: isbang/compose-action@v1.2.0
with:
compose-file: "./docker/docker-compose.yml"
env:
CUSTOM_VARIABLE: "test"
```

View File

@ -0,0 +1,8 @@
version: "3.8"
volumes:
test_volume: {}
services:
helloworld:
image: ${IMAGE_NAME}

View File

@ -18,6 +18,7 @@ try {
commandOptions: utils.parseFlags(core.getInput("up-flags")), commandOptions: utils.parseFlags(core.getInput("up-flags")),
}; };
const services = core.getMultilineInput("services", { required: false });
const promise = const promise =
services.length > 0 services.length > 0
? compose.upMany(services, options) ? compose.upMany(services, options)