diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cddfbf5..55c73fb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,6 +25,11 @@ jobs: compose-file: "./docker/docker-compose.yml" compose-flags: "--profile profile-1" down-flags: "--volumes" + - uses: ./ + with: + compose-file: "./docker/docker-compose-with-env.yml" + env: + IMAGE_NAME: hello-world - uses: ./ with: compose-file: | @@ -32,4 +37,4 @@ jobs: ./docker/docker-compose.ci.yml services: | helloworld2 - helloworld4 \ No newline at end of file + helloworld4 diff --git a/README.md b/README.md index afa14bf..374038d 100644 --- a/README.md +++ b/README.md @@ -46,3 +46,15 @@ steps: helloworld2 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" +``` diff --git a/docker/docker-compose-with-env.yml b/docker/docker-compose-with-env.yml new file mode 100644 index 0000000..19018bd --- /dev/null +++ b/docker/docker-compose-with-env.yml @@ -0,0 +1,8 @@ +version: "3.8" + +volumes: + test_volume: {} + +services: + helloworld: + image: ${IMAGE_NAME} diff --git a/main.js b/main.js index 5861e53..7e3b63b 100644 --- a/main.js +++ b/main.js @@ -18,6 +18,7 @@ try { commandOptions: utils.parseFlags(core.getInput("up-flags")), }; + const services = core.getMultilineInput("services", { required: false }); const promise = services.length > 0 ? compose.upMany(services, options)