mirror of
https://github.com/hoverkraft-tech/compose-action.git
synced 2026-01-12 23:53:07 +08:00
Compare commits
7 Commits
57a2375c11
...
b9f10db4fd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b9f10db4fd | ||
|
|
b716db5b71 | ||
|
|
88b85ef80e | ||
|
|
ab0fa7d95d | ||
|
|
82f56cc549 | ||
|
|
650d8e8740 | ||
|
|
b49a5ca3bb |
2
.github/workflows/__shared-ci.yml
vendored
2
.github/workflows/__shared-ci.yml
vendored
@ -13,7 +13,7 @@ permissions:
|
||||
|
||||
jobs:
|
||||
linter:
|
||||
uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@b4883995e100e291a1fed68678d47a560328ed08 # 0.24.0
|
||||
uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@d324c777132734fc988c79a74dff3ee0248835fc # 0.25.0
|
||||
with:
|
||||
linter-env: |
|
||||
FILTER_REGEX_EXCLUDE=dist/**/*
|
||||
|
||||
2
.github/workflows/greetings.yml
vendored
2
.github/workflows/greetings.yml
vendored
@ -13,4 +13,4 @@ permissions:
|
||||
|
||||
jobs:
|
||||
greetings:
|
||||
uses: hoverkraft-tech/ci-github-common/.github/workflows/greetings.yml@b4883995e100e291a1fed68678d47a560328ed08 # 0.24.0
|
||||
uses: hoverkraft-tech/ci-github-common/.github/workflows/greetings.yml@d324c777132734fc988c79a74dff3ee0248835fc # 0.25.0
|
||||
|
||||
6
.github/workflows/main-ci.yml
vendored
6
.github/workflows/main-ci.yml
vendored
@ -36,17 +36,17 @@ jobs:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: 📖 Generate documentation
|
||||
uses: hoverkraft-tech/ci-dokumentor@002e0be35c188aa703fcc656d2db8f128800f723 # 0.1.0
|
||||
uses: hoverkraft-tech/ci-dokumentor@fe7b78e19572b70e2a5db7f2a61b99c70358061a # 0.1.2
|
||||
with:
|
||||
source: action.yml
|
||||
|
||||
- uses: actions/create-github-app-token@a8d616148505b5069dccd32f177bb87d7f39123b # v2.1.1
|
||||
- uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4
|
||||
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@b4883995e100e291a1fed68678d47a560328ed08 # 0.24.0
|
||||
- uses: hoverkraft-tech/ci-github-common/actions/create-and-merge-pull-request@d324c777132734fc988c79a74dff3ee0248835fc # 0.25.0
|
||||
with:
|
||||
github-token: ${{ steps.generate-token.outputs.token }}
|
||||
branch: docs/actions-workflows-documentation-update
|
||||
|
||||
2
.github/workflows/need-fix-to-issue.yml
vendored
2
.github/workflows/need-fix-to-issue.yml
vendored
@ -21,7 +21,7 @@ permissions:
|
||||
|
||||
jobs:
|
||||
main:
|
||||
uses: hoverkraft-tech/ci-github-common/.github/workflows/need-fix-to-issue.yml@b4883995e100e291a1fed68678d47a560328ed08 # 0.24.0
|
||||
uses: hoverkraft-tech/ci-github-common/.github/workflows/need-fix-to-issue.yml@d324c777132734fc988c79a74dff3ee0248835fc # 0.25.0
|
||||
with:
|
||||
manual-commit-ref: ${{ inputs.manual-commit-ref }}
|
||||
manual-base-ref: ${{ inputs.manual-base-ref }}
|
||||
|
||||
2
.github/workflows/semantic-pull-request.yml
vendored
2
.github/workflows/semantic-pull-request.yml
vendored
@ -13,4 +13,4 @@ permissions:
|
||||
|
||||
jobs:
|
||||
main:
|
||||
uses: hoverkraft-tech/ci-github-common/.github/workflows/semantic-pull-request.yml@b4883995e100e291a1fed68678d47a560328ed08 # 0.24.0
|
||||
uses: hoverkraft-tech/ci-github-common/.github/workflows/semantic-pull-request.yml@d324c777132734fc988c79a74dff3ee0248835fc # 0.25.0
|
||||
|
||||
2
.github/workflows/stale.yml
vendored
2
.github/workflows/stale.yml
vendored
@ -10,4 +10,4 @@ permissions:
|
||||
|
||||
jobs:
|
||||
main:
|
||||
uses: hoverkraft-tech/ci-github-common/.github/workflows/stale.yml@b4883995e100e291a1fed68678d47a560328ed08 # 0.24.0
|
||||
uses: hoverkraft-tech/ci-github-common/.github/workflows/stale.yml@d324c777132734fc988c79a74dff3ee0248835fc # 0.25.0
|
||||
|
||||
30
README.md
30
README.md
@ -37,7 +37,7 @@ Some extra options can be passed to the `docker compose up` command using the `u
|
||||
On post hook, the action will run `docker compose down` to clean up the services.
|
||||
|
||||
Logs of the Docker Compose services are logged using GitHub `core.ts` API before the cleanup.
|
||||
The log level can be set using the `services-log-level` input.
|
||||
The log level can be set using the `services-log-level` input.
|
||||
The default is `debug`, which will only print logs if [debug mode](https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/troubleshooting-workflows/enabling-debug-logging) is switched on.
|
||||
|
||||
Some extra options can be passed to the `docker compose down` command using the `down-flags` input.
|
||||
@ -48,7 +48,7 @@ Some extra options can be passed to the `docker compose down` command using the
|
||||
## Usage
|
||||
|
||||
```yaml
|
||||
- uses: hoverkraft-tech/compose-action@40041ff1b97dbf152cd2361138c2b03fa29139df # v2.3.0
|
||||
- uses: hoverkraft-tech/compose-action@b716db5b717cb9b81e391fe638e5aceaa2299e43 # v2.4.0
|
||||
with:
|
||||
# Additional options to pass to `docker` command.
|
||||
docker-flags: ""
|
||||
@ -123,6 +123,8 @@ Some extra options can be passed to the `docker compose down` command using the
|
||||
|
||||
## Examples
|
||||
|
||||
### Example using in a full workflow
|
||||
|
||||
```yaml
|
||||
name: Docker Compose Action
|
||||
|
||||
@ -136,7 +138,7 @@ jobs:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
|
||||
- name: Run docker compose
|
||||
uses: hoverkraft-tech/compose-action@40041ff1b97dbf152cd2361138c2b03fa29139df # v2.3.0
|
||||
uses: hoverkraft-tech/compose-action@b716db5b717cb9b81e391fe638e5aceaa2299e43 # v2.4.0
|
||||
with:
|
||||
compose-file: "./docker/docker-compose.yml"
|
||||
|
||||
@ -145,23 +147,27 @@ jobs:
|
||||
docker compose exec test-app pytest
|
||||
```
|
||||
|
||||
### Example Using environment variables
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v4.2.2
|
||||
- uses: hoverkraft-tech/compose-action@40041ff1b97dbf152cd2361138c2b03fa29139df # v2.3.0
|
||||
- uses: hoverkraft-tech/compose-action@b716db5b717cb9b81e391fe638e5aceaa2299e43 # v2.4.0
|
||||
with:
|
||||
compose-file: "./docker/docker-compose.yml"
|
||||
env:
|
||||
CUSTOM_VARIABLE: "test"
|
||||
```
|
||||
|
||||
### 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@40041ff1b97dbf152cd2361138c2b03fa29139df # v2.3.0
|
||||
- uses: hoverkraft-tech/compose-action@b716db5b717cb9b81e391fe638e5aceaa2299e43 # v2.4.0
|
||||
with:
|
||||
compose-file: "./docker/docker-compose.yml"
|
||||
services: |
|
||||
@ -169,6 +175,8 @@ steps:
|
||||
helloworld3
|
||||
```
|
||||
|
||||
### Example using `up-flags`
|
||||
|
||||
Specify flags to pass to the `docker compose up`.
|
||||
|
||||
Default is none.
|
||||
@ -177,6 +185,8 @@ Can be used to pass the `--build` flag, for example, if you want persistent volu
|
||||
|
||||
A full list of flags can be found in the [Docker compose up documentation](https://docs.docker.com/compose/reference/up/).
|
||||
|
||||
### Example using `down-flags`
|
||||
|
||||
Specify flags to pass to the `docker compose down` command during cleanup.
|
||||
|
||||
Default is none.
|
||||
@ -185,6 +195,8 @@ Can be used to pass the want persistent volumes to be deleted as well during cle
|
||||
|
||||
A full list of flags can be found in the [Docker compose down documentation](https://docs.docker.com/compose/reference/down/).
|
||||
|
||||
### 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).
|
||||
@ -193,12 +205,10 @@ A full list of flags can be found in the [Docker compose documentation](https://
|
||||
steps:
|
||||
# need checkout before using compose-action
|
||||
- uses: actions/checkout@v3
|
||||
- uses: hoverkraft-tech/compose-action@40041ff1b97dbf152cd2361138c2b03fa29139df # v2.3.0
|
||||
- uses: hoverkraft-tech/compose-action@b716db5b717cb9b81e391fe638e5aceaa2299e43 # v2.4.0
|
||||
with:
|
||||
compose-file: "./docker/docker-compose.yml"
|
||||
services: |
|
||||
helloworld2
|
||||
helloworld3
|
||||
compose-flags: "--profile profile-1"
|
||||
```
|
||||
|
||||
Specify multiple compose files to use with the `docker compose` command.
|
||||
@ -209,7 +219,7 @@ This is useful when you have a base compose file and additional files for differ
|
||||
steps:
|
||||
# need checkout before using compose-action
|
||||
- uses: actions/checkout@v3
|
||||
- uses: hoverkraft-tech/compose-action@40041ff1b97dbf152cd2361138c2b03fa29139df # v2.3.0
|
||||
- uses: hoverkraft-tech/compose-action@b716db5b717cb9b81e391fe638e5aceaa2299e43 # v2.4.0
|
||||
with:
|
||||
compose-file: |
|
||||
./docker/docker-compose.yml
|
||||
|
||||
35
action.yml
35
action.yml
@ -1,23 +1,20 @@
|
||||
# ### Action
|
||||
#
|
||||
# The action will run `docker compose up` to start the services defined in the given compose file(s).
|
||||
# The compose file(s) can be specified using the `compose-file` input.
|
||||
# Some extra options can be passed to the `docker compose up` command using the `up-flags` input.
|
||||
#
|
||||
# ### Post hook
|
||||
#
|
||||
# On post hook, the action will run `docker compose down` to clean up the services.
|
||||
#
|
||||
# Logs of the Docker Compose services are logged using GitHub `core.ts` API before the cleanup.
|
||||
# The log level can be set using the `services-log-level` input.
|
||||
# The default is `debug`, which will only print logs if [debug mode](https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/troubleshooting-workflows/enabling-debug-logging) is switched on.
|
||||
#
|
||||
# Some extra options can be passed to the `docker compose down` command using the `down-flags` input.
|
||||
name: "Docker Compose Action"
|
||||
description: |
|
||||
This action runs your compose file(s) and clean up before action finished
|
||||
|
||||
### Action
|
||||
|
||||
The action will run `docker compose up` to start the services defined in the given compose file(s).
|
||||
The compose file(s) can be specified using the `compose-file` input.
|
||||
Some extra options can be passed to the `docker compose up` command using the `up-flags` input.
|
||||
|
||||
### Post hook
|
||||
|
||||
On post hook, the action will run `docker compose down` to clean up the services.
|
||||
|
||||
Logs of the Docker Compose services are logged using GitHub `core.ts` API before the cleanup.
|
||||
The log level can be set using the `services-log-level` input.
|
||||
The default is `debug`, which will only print logs if [debug mode](https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/troubleshooting-workflows/enabling-debug-logging) is switched on.
|
||||
|
||||
Some extra options can be passed to the `docker compose down` command using the `down-flags` input.
|
||||
|
||||
description: This action runs your compose file(s) and clean up before action finished
|
||||
author: "hoverkraft"
|
||||
branding:
|
||||
icon: anchor
|
||||
|
||||
7
dist/index.js
generated
vendored
7
dist/index.js
generated
vendored
@ -10321,9 +10321,12 @@ const restartOne = function (service, options) {
|
||||
};
|
||||
exports.restartOne = restartOne;
|
||||
const logs = function (services, options = {}) {
|
||||
let args = Array.isArray(services) ? services : [services];
|
||||
const args = Array.isArray(services) ? services : [services];
|
||||
if (options.follow) {
|
||||
args = ['--follow', ...args];
|
||||
args.unshift('--follow');
|
||||
}
|
||||
if (options.timestamps) {
|
||||
args.unshift('--timestamps');
|
||||
}
|
||||
return (0, exports.execCompose)('logs', args, options);
|
||||
};
|
||||
|
||||
7
dist/post.js
generated
vendored
7
dist/post.js
generated
vendored
@ -3610,9 +3610,12 @@ const restartOne = function (service, options) {
|
||||
};
|
||||
exports.restartOne = restartOne;
|
||||
const logs = function (services, options = {}) {
|
||||
let args = Array.isArray(services) ? services : [services];
|
||||
const args = Array.isArray(services) ? services : [services];
|
||||
if (options.follow) {
|
||||
args = ['--follow', ...args];
|
||||
args.unshift('--follow');
|
||||
}
|
||||
if (options.timestamps) {
|
||||
args.unshift('--timestamps');
|
||||
}
|
||||
return (0, exports.execCompose)('logs', args, options);
|
||||
};
|
||||
|
||||
25
package-lock.json
generated
25
package-lock.json
generated
@ -13,11 +13,11 @@
|
||||
"@actions/github": "^6.0.1",
|
||||
"@actions/tool-cache": "^2.0.2",
|
||||
"@octokit/action": "^8.0.2",
|
||||
"docker-compose": "^1.2.0"
|
||||
"docker-compose": "^1.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ts-dev-tools/core": "^1.9.5",
|
||||
"@vercel/ncc": "^0.38.3",
|
||||
"@ts-dev-tools/core": "^1.9.6",
|
||||
"@vercel/ncc": "^0.38.4",
|
||||
"eslint-plugin-github": "^6.0.0",
|
||||
"eslint-plugin-jsonc": "^2.20.1"
|
||||
},
|
||||
@ -2690,9 +2690,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@ts-dev-tools/core": {
|
||||
"version": "1.9.5",
|
||||
"resolved": "https://registry.npmjs.org/@ts-dev-tools/core/-/core-1.9.5.tgz",
|
||||
"integrity": "sha512-i5MKnEx8wtaU4VIitl+ddtLzV0vNpQQZYeYnZEYrKb7gBhaABNXjTnhYJCBNdKi/ExqlNc+QtCNuzbTP2hh2YA==",
|
||||
"version": "1.9.6",
|
||||
"resolved": "https://registry.npmjs.org/@ts-dev-tools/core/-/core-1.9.6.tgz",
|
||||
"integrity": "sha512-jTn6iz39gU7mK+X+QaYQ/bWs+uzJ8eQKsD8elxd0Q2ec5Lh4ZTGti5lNGXV8UO3OnPYCNjVKBmhj6hYqgZ3MUg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@ -4748,10 +4748,11 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@vercel/ncc": {
|
||||
"version": "0.38.3",
|
||||
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.3.tgz",
|
||||
"integrity": "sha512-rnK6hJBS6mwc+Bkab+PGPs9OiS0i/3kdTO+CkI8V0/VrW3vmz7O2Pxjw/owOlmo6PKEIxRSeZKv/kuL9itnpYA==",
|
||||
"version": "0.38.4",
|
||||
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.4.tgz",
|
||||
"integrity": "sha512-8LwjnlP39s08C08J5NstzriPvW1SP8Zfpp1BvC2sI35kPeZnHfxVkCwu4/+Wodgnd60UtT1n8K8zw+Mp7J9JmQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"ncc": "dist/ncc/cli.js"
|
||||
}
|
||||
@ -5932,9 +5933,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/docker-compose": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/docker-compose/-/docker-compose-1.2.0.tgz",
|
||||
"integrity": "sha512-wIU1eHk3Op7dFgELRdmOYlPYS4gP8HhH1ZmZa13QZF59y0fblzFDFmKPhyc05phCy2hze9OEvNZAsoljrs+72w==",
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/docker-compose/-/docker-compose-1.3.0.tgz",
|
||||
"integrity": "sha512-7Gevk/5eGD50+eMD+XDnFnOrruFkL0kSd7jEG4cjmqweDSUhB7i0g8is/nBdVpl+Bx338SqIB2GLKm32M+Vs6g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"yaml": "^2.2.2"
|
||||
|
||||
@ -28,11 +28,11 @@
|
||||
"@actions/github": "^6.0.1",
|
||||
"@actions/tool-cache": "^2.0.2",
|
||||
"@octokit/action": "^8.0.2",
|
||||
"docker-compose": "^1.2.0"
|
||||
"docker-compose": "^1.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ts-dev-tools/core": "^1.9.5",
|
||||
"@vercel/ncc": "^0.38.3",
|
||||
"@ts-dev-tools/core": "^1.9.6",
|
||||
"@vercel/ncc": "^0.38.4",
|
||||
"eslint-plugin-github": "^6.0.0",
|
||||
"eslint-plugin-jsonc": "^2.20.1"
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user