ci: auto-generate README

Signed-off-by: Emilien Escalle <emilien.escalle@escemi.com>
This commit is contained in:
Emilien Escalle 2024-03-26 13:10:57 +01:00
parent f36b65977d
commit e16b76985c
9 changed files with 123 additions and 69 deletions

17
.ghadocs.json Normal file
View File

@ -0,0 +1,17 @@
{
"paths": {
"action": "action.yml",
"readme": "README.md"
},
"show_logo": true,
"versioning": {
"enabled": true,
"override": "",
"prefix": "v",
"branch": "main"
},
"owner": "bitflight-devops",
"repo": "github-action-readme-generator",
"title_prefix": "GitHub Action: ",
"prettier": true
}

View File

@ -0,0 +1,12 @@
<!-- markdownlint-disable-next-line first-line-heading -->
### 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"
```

16
.github/ghadocs/examples/2_services.md vendored Normal file
View File

@ -0,0 +1,16 @@
<!-- markdownlint-disable-next-line first-line-heading -->
### 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
```

View File

@ -0,0 +1,4 @@
<!-- markdownlint-disable-next-line first-line-heading -->
### 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/).

View File

@ -0,0 +1,4 @@
<!-- markdownlint-disable-next-line first-line-heading -->
### 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/).

View File

@ -0,0 +1,16 @@
<!-- markdownlint-disable-next-line first-line-heading -->
### 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
```

View File

@ -12,3 +12,25 @@ jobs:
ci:
uses: ./.github/workflows/__shared-ci.yml
secrets: inherit
generate-readme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bitflight-devops/github-action-readme-generator@v1.8.0
- uses: actions/create-github-app-token@v1
id: generate-token
with:
app-id: ${{ vars.CI_BOT_APP_ID }}
private-key: ${{ secrets.CI_BOT_APP_PRIVATE_KEY }}
- uses: hoverkraft-tech/ci-github-common/actions/create-and-merge-pull-request@main
with:
github-token: ${{ steps.generate-token.outputs.token }}
branch: docs/actions-workflows-documentation-update
title: "docs: update actions and workflows documentation"
body: Update actions and workflows documentation
commit-message: |
docs: update actions and workflows documentation
[skip ci]

View File

@ -1,60 +1,23 @@
# Docker Compose Action
<!-- markdownlint-disable-next-line first-line-heading -->
<div align="center" width="100%">
<!-- start branding -->
<!-- end branding -->
<!-- start title -->
<!-- end title -->
<!-- start badges -->
<!-- end badges -->
---
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>
<!-- 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/] -->

View File

@ -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: