Skip to content

Commit

Permalink
ci: auto-generate README
Browse files Browse the repository at this point in the history
Signed-off-by: Emilien Escalle <emilien.escalle@escemi.com>
  • Loading branch information
neilime committed Mar 26, 2024
1 parent f36b659 commit 051c493
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 70 deletions.
11 changes: 11 additions & 0 deletions .github/ghadocs/examples/1_environment-variables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### Example Using environment variables

```yaml
steps:
- uses: actions/checkout@v4
- uses: hoverkraft-tech/compose-action@v1.5.1
with:
compose-file: "./docker/docker-compose.yml"
env:
CUSTOM_VARIABLE: "test"
```
15 changes: 15 additions & 0 deletions .github/ghadocs/examples/2_services.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
### Example using `services`

Perform `docker-compose up` to some given service instead of all of them

```yaml
steps:
# need checkout before using compose-action
- uses: actions/checkout@v3
- uses: hoverkraft-tech/compose-action@v1.5.1
with:
compose-file: "./docker/docker-compose.yml"
services: |
helloworld2
helloworld3
```
3 changes: 3 additions & 0 deletions .github/ghadocs/examples/3_up-flags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Example using `up-flags`

Specify flags to pass to the `docker-compose up`. Default is none. Can be used to pass the `--build` flag, for example, if you want persistent volumes to be deleted as well during cleanup. A full list of flags can be found in the [docker-compose up documentation](https://docs.docker.com/compose/reference/up/).
3 changes: 3 additions & 0 deletions .github/ghadocs/examples/4_down-flags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Example using `down-flags`

Specify flags to pass to the `docker-compose down` command during cleanup. Default is none. Can be used to pass the `--volumes` flag, for example, if you want persistent volumes to be deleted as well during cleanup. A full list of flags can be found in the [docker-compose down documentation](https://docs.docker.com/compose/reference/down/).
15 changes: 15 additions & 0 deletions .github/ghadocs/examples/5_compose-flags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
### Example using `compose-flags`

Specify flags to pass to the `docker-compose` command. Default is none. A full list of flags can be found in the [docker-compose documentation](https://docs.docker.com/compose/reference/#command-options-overview-and-help).

```yaml
steps:
# need checkout before using compose-action
- uses: actions/checkout@v3
- uses: hoverkraft-tech/compose-action@v1.5.1
with:
compose-file: "./docker/docker-compose.yml"
services: |
helloworld2
helloworld3
```
8 changes: 7 additions & 1 deletion .github/workflows/main-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@ concurrency:
jobs:
ci:
uses: ./.github/workflows/__shared-ci.yml
secrets: inherit
secrets: inherit

generate-readme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bitflight-devops/github-action-readme-generator@v1.8.0
82 changes: 22 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,22 @@
# Docker Compose Action

This action runs your docker-compose file and clean up before action finished.

## Inputs

### `compose-file`

**Optional** The name of the compose file. Default `"./docker-compose.yml"`.

It can be a list of files:

```yml
compose-file: |
docker-compose.yml
docker-compose.ci.yml
```
### `services`

**Optional** Just perform `docker-compose up` to one service instead of all of them

### `up-flags`

**Optional** Used to specify flags to pass to the `docker-compose up`. Default is none. Can be used to pass the `--build` flag, for example, if you want persistent volumes to be deleted as well during cleanup. A full list of flags can be found in the [docker-compose up documentation](https://docs.docker.com/compose/reference/up/).

### `down-flags`

**Optional** Used to specify flags to pass to the `docker-compose down` command during cleanup. Default is none. Can be used to pass the `--volumes` flag, for example, if you want persistent volumes to be deleted as well during cleanup. A full list of flags can be found in the [docker-compose down documentation](https://docs.docker.com/compose/reference/down/).

### `compose-flags`

**Optional** Used to specify flags to pass to the `docker-compose` command. Default is none. A full list of flags can be found in the [docker-compose documentation](https://docs.docker.com/compose/reference/#command-options-overview-and-help).

## Example usage

```yaml
steps:
# need checkout before using compose-action
- uses: actions/checkout@v3
- uses: hoverkraft-tech/compose-action@v1.5.1
with:
compose-file: "./docker/docker-compose.yml"
down-flags: "--volumes"
services: |
helloworld2
helloworld3
```

### Using environment variables

```yaml
steps:
- uses: actions/checkout@v3
- uses: hoverkraft-tech/compose-action@v1.5.1
with:
compose-file: "./docker/docker-compose.yml"
env:
CUSTOM_VARIABLE: "test"
```
<div align="center" width="100%">
<!-- start branding -->
<!-- end branding -->
<!-- start title -->
<!-- end title -->
<!-- start badges -->
<!-- end badges -->
---

</div>
<!-- start description -->
<!-- end description -->
<!-- start contents -->
<!-- end contents -->
<!-- start usage -->
<!-- end usage -->
<!-- start inputs -->
<!-- end inputs -->
<!-- start outputs -->
<!-- end outputs -->
<!-- start [.github/ghadocs/examples/] -->
<!-- end [.github/ghadocs/examples/] -->
18 changes: 9 additions & 9 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ name: "Docker Compose Action"
description: "Run your docker-compose file"
inputs:
compose-file:
description: "relative path to compose file(s)"
description: "Relative path to compose file(s). It can be a list of files."
required: false
default: "./docker-compose.yml"
compose-flags:
description: "additional options to pass to `docker-compose` command"
services:
description: "Services to perform docker-compose up."
required: false
up-flags:
description: "Additional options to pass to `docker-compose up` command."
required: false
default: ""
down-flags:
description: "additional options to pass to `docker-compose down` command"
description: "Additional options to pass to `docker-compose down` command."
required: false
default: ""
services:
description: "services to perform docker-compose up"
required: false
up-flags:
description: "additional options to pass to `docker-compose up` command"
compose-flags:
description: "Additional options to pass to `docker-compose` command."
required: false
default: ""
runs:
Expand Down

0 comments on commit 051c493

Please sign in to comment.