Compare commits

..

No commits in common. "b9f10db4fdfefef9e4a76506013b4021b4fd3c5d" and "57a2375c118628c10609e2c4fcaf7c9c65c0c7ef" have entirely different histories.

12 changed files with 56 additions and 70 deletions

View File

@ -13,7 +13,7 @@ permissions:
jobs: jobs:
linter: linter:
uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@d324c777132734fc988c79a74dff3ee0248835fc # 0.25.0 uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@b4883995e100e291a1fed68678d47a560328ed08 # 0.24.0
with: with:
linter-env: | linter-env: |
FILTER_REGEX_EXCLUDE=dist/**/* FILTER_REGEX_EXCLUDE=dist/**/*

View File

@ -13,4 +13,4 @@ permissions:
jobs: jobs:
greetings: greetings:
uses: hoverkraft-tech/ci-github-common/.github/workflows/greetings.yml@d324c777132734fc988c79a74dff3ee0248835fc # 0.25.0 uses: hoverkraft-tech/ci-github-common/.github/workflows/greetings.yml@b4883995e100e291a1fed68678d47a560328ed08 # 0.24.0

View File

@ -36,17 +36,17 @@ jobs:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: 📖 Generate documentation - name: 📖 Generate documentation
uses: hoverkraft-tech/ci-dokumentor@fe7b78e19572b70e2a5db7f2a61b99c70358061a # 0.1.2 uses: hoverkraft-tech/ci-dokumentor@002e0be35c188aa703fcc656d2db8f128800f723 # 0.1.0
with: with:
source: action.yml source: action.yml
- uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4 - uses: actions/create-github-app-token@a8d616148505b5069dccd32f177bb87d7f39123b # v2.1.1
id: generate-token id: generate-token
with: with:
app-id: ${{ vars.CI_BOT_APP_ID }} app-id: ${{ vars.CI_BOT_APP_ID }}
private-key: ${{ secrets.CI_BOT_APP_PRIVATE_KEY }} private-key: ${{ secrets.CI_BOT_APP_PRIVATE_KEY }}
- uses: hoverkraft-tech/ci-github-common/actions/create-and-merge-pull-request@d324c777132734fc988c79a74dff3ee0248835fc # 0.25.0 - uses: hoverkraft-tech/ci-github-common/actions/create-and-merge-pull-request@b4883995e100e291a1fed68678d47a560328ed08 # 0.24.0
with: with:
github-token: ${{ steps.generate-token.outputs.token }} github-token: ${{ steps.generate-token.outputs.token }}
branch: docs/actions-workflows-documentation-update branch: docs/actions-workflows-documentation-update

View File

@ -21,7 +21,7 @@ permissions:
jobs: jobs:
main: main:
uses: hoverkraft-tech/ci-github-common/.github/workflows/need-fix-to-issue.yml@d324c777132734fc988c79a74dff3ee0248835fc # 0.25.0 uses: hoverkraft-tech/ci-github-common/.github/workflows/need-fix-to-issue.yml@b4883995e100e291a1fed68678d47a560328ed08 # 0.24.0
with: with:
manual-commit-ref: ${{ inputs.manual-commit-ref }} manual-commit-ref: ${{ inputs.manual-commit-ref }}
manual-base-ref: ${{ inputs.manual-base-ref }} manual-base-ref: ${{ inputs.manual-base-ref }}

View File

@ -13,4 +13,4 @@ permissions:
jobs: jobs:
main: main:
uses: hoverkraft-tech/ci-github-common/.github/workflows/semantic-pull-request.yml@d324c777132734fc988c79a74dff3ee0248835fc # 0.25.0 uses: hoverkraft-tech/ci-github-common/.github/workflows/semantic-pull-request.yml@b4883995e100e291a1fed68678d47a560328ed08 # 0.24.0

View File

@ -10,4 +10,4 @@ permissions:
jobs: jobs:
main: main:
uses: hoverkraft-tech/ci-github-common/.github/workflows/stale.yml@d324c777132734fc988c79a74dff3ee0248835fc # 0.25.0 uses: hoverkraft-tech/ci-github-common/.github/workflows/stale.yml@b4883995e100e291a1fed68678d47a560328ed08 # 0.24.0

View File

@ -48,7 +48,7 @@ Some extra options can be passed to the `docker compose down` command using the
## Usage ## Usage
```yaml ```yaml
- uses: hoverkraft-tech/compose-action@b716db5b717cb9b81e391fe638e5aceaa2299e43 # v2.4.0 - uses: hoverkraft-tech/compose-action@40041ff1b97dbf152cd2361138c2b03fa29139df # v2.3.0
with: with:
# Additional options to pass to `docker` command. # Additional options to pass to `docker` command.
docker-flags: "" docker-flags: ""
@ -123,8 +123,6 @@ Some extra options can be passed to the `docker compose down` command using the
## Examples ## Examples
### Example using in a full workflow
```yaml ```yaml
name: Docker Compose Action name: Docker Compose Action
@ -138,7 +136,7 @@ jobs:
- uses: actions/checkout@v4.2.2 - uses: actions/checkout@v4.2.2
- name: Run docker compose - name: Run docker compose
uses: hoverkraft-tech/compose-action@b716db5b717cb9b81e391fe638e5aceaa2299e43 # v2.4.0 uses: hoverkraft-tech/compose-action@40041ff1b97dbf152cd2361138c2b03fa29139df # v2.3.0
with: with:
compose-file: "./docker/docker-compose.yml" compose-file: "./docker/docker-compose.yml"
@ -147,27 +145,23 @@ jobs:
docker compose exec test-app pytest docker compose exec test-app pytest
``` ```
### Example Using environment variables
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4.2.2 - uses: actions/checkout@v4.2.2
- uses: hoverkraft-tech/compose-action@b716db5b717cb9b81e391fe638e5aceaa2299e43 # v2.4.0 - uses: hoverkraft-tech/compose-action@40041ff1b97dbf152cd2361138c2b03fa29139df # v2.3.0
with: with:
compose-file: "./docker/docker-compose.yml" compose-file: "./docker/docker-compose.yml"
env: env:
CUSTOM_VARIABLE: "test" CUSTOM_VARIABLE: "test"
``` ```
### Example using `services`
Perform `docker compose up` to some given service instead of all of them Perform `docker compose up` to some given service instead of all of them
```yaml ```yaml
steps: steps:
# need checkout before using compose-action # need checkout before using compose-action
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: hoverkraft-tech/compose-action@b716db5b717cb9b81e391fe638e5aceaa2299e43 # v2.4.0 - uses: hoverkraft-tech/compose-action@40041ff1b97dbf152cd2361138c2b03fa29139df # v2.3.0
with: with:
compose-file: "./docker/docker-compose.yml" compose-file: "./docker/docker-compose.yml"
services: | services: |
@ -175,8 +169,6 @@ steps:
helloworld3 helloworld3
``` ```
### Example using `up-flags`
Specify flags to pass to the `docker compose up`. Specify flags to pass to the `docker compose up`.
Default is none. Default is none.
@ -185,8 +177,6 @@ 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/). 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. Specify flags to pass to the `docker compose down` command during cleanup.
Default is none. Default is none.
@ -195,8 +185,6 @@ 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/). 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. 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). A full list of flags can be found in the [Docker compose documentation](https://docs.docker.com/compose/reference/#command-options-overview-and-help).
@ -205,10 +193,12 @@ A full list of flags can be found in the [Docker compose documentation](https://
steps: steps:
# need checkout before using compose-action # need checkout before using compose-action
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: hoverkraft-tech/compose-action@b716db5b717cb9b81e391fe638e5aceaa2299e43 # v2.4.0 - uses: hoverkraft-tech/compose-action@40041ff1b97dbf152cd2361138c2b03fa29139df # v2.3.0
with: with:
compose-file: "./docker/docker-compose.yml" compose-file: "./docker/docker-compose.yml"
compose-flags: "--profile profile-1" services: |
helloworld2
helloworld3
``` ```
Specify multiple compose files to use with the `docker compose` command. Specify multiple compose files to use with the `docker compose` command.
@ -219,7 +209,7 @@ This is useful when you have a base compose file and additional files for differ
steps: steps:
# need checkout before using compose-action # need checkout before using compose-action
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: hoverkraft-tech/compose-action@b716db5b717cb9b81e391fe638e5aceaa2299e43 # v2.4.0 - uses: hoverkraft-tech/compose-action@40041ff1b97dbf152cd2361138c2b03fa29139df # v2.3.0
with: with:
compose-file: | compose-file: |
./docker/docker-compose.yml ./docker/docker-compose.yml

View File

@ -1,20 +1,23 @@
# ### 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" name: "Docker Compose Action"
description: This action runs your compose file(s) and clean up before action finished 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.
author: "hoverkraft" author: "hoverkraft"
branding: branding:
icon: anchor icon: anchor

7
dist/index.js generated vendored
View File

@ -10321,12 +10321,9 @@ const restartOne = function (service, options) {
}; };
exports.restartOne = restartOne; exports.restartOne = restartOne;
const logs = function (services, options = {}) { const logs = function (services, options = {}) {
const args = Array.isArray(services) ? services : [services]; let args = Array.isArray(services) ? services : [services];
if (options.follow) { if (options.follow) {
args.unshift('--follow'); args = ['--follow', ...args];
}
if (options.timestamps) {
args.unshift('--timestamps');
} }
return (0, exports.execCompose)('logs', args, options); return (0, exports.execCompose)('logs', args, options);
}; };

7
dist/post.js generated vendored
View File

@ -3610,12 +3610,9 @@ const restartOne = function (service, options) {
}; };
exports.restartOne = restartOne; exports.restartOne = restartOne;
const logs = function (services, options = {}) { const logs = function (services, options = {}) {
const args = Array.isArray(services) ? services : [services]; let args = Array.isArray(services) ? services : [services];
if (options.follow) { if (options.follow) {
args.unshift('--follow'); args = ['--follow', ...args];
}
if (options.timestamps) {
args.unshift('--timestamps');
} }
return (0, exports.execCompose)('logs', args, options); return (0, exports.execCompose)('logs', args, options);
}; };

25
package-lock.json generated
View File

@ -13,11 +13,11 @@
"@actions/github": "^6.0.1", "@actions/github": "^6.0.1",
"@actions/tool-cache": "^2.0.2", "@actions/tool-cache": "^2.0.2",
"@octokit/action": "^8.0.2", "@octokit/action": "^8.0.2",
"docker-compose": "^1.3.0" "docker-compose": "^1.2.0"
}, },
"devDependencies": { "devDependencies": {
"@ts-dev-tools/core": "^1.9.6", "@ts-dev-tools/core": "^1.9.5",
"@vercel/ncc": "^0.38.4", "@vercel/ncc": "^0.38.3",
"eslint-plugin-github": "^6.0.0", "eslint-plugin-github": "^6.0.0",
"eslint-plugin-jsonc": "^2.20.1" "eslint-plugin-jsonc": "^2.20.1"
}, },
@ -2690,9 +2690,9 @@
} }
}, },
"node_modules/@ts-dev-tools/core": { "node_modules/@ts-dev-tools/core": {
"version": "1.9.6", "version": "1.9.5",
"resolved": "https://registry.npmjs.org/@ts-dev-tools/core/-/core-1.9.6.tgz", "resolved": "https://registry.npmjs.org/@ts-dev-tools/core/-/core-1.9.5.tgz",
"integrity": "sha512-jTn6iz39gU7mK+X+QaYQ/bWs+uzJ8eQKsD8elxd0Q2ec5Lh4ZTGti5lNGXV8UO3OnPYCNjVKBmhj6hYqgZ3MUg==", "integrity": "sha512-i5MKnEx8wtaU4VIitl+ddtLzV0vNpQQZYeYnZEYrKb7gBhaABNXjTnhYJCBNdKi/ExqlNc+QtCNuzbTP2hh2YA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@ -4748,11 +4748,10 @@
] ]
}, },
"node_modules/@vercel/ncc": { "node_modules/@vercel/ncc": {
"version": "0.38.4", "version": "0.38.3",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.4.tgz", "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.3.tgz",
"integrity": "sha512-8LwjnlP39s08C08J5NstzriPvW1SP8Zfpp1BvC2sI35kPeZnHfxVkCwu4/+Wodgnd60UtT1n8K8zw+Mp7J9JmQ==", "integrity": "sha512-rnK6hJBS6mwc+Bkab+PGPs9OiS0i/3kdTO+CkI8V0/VrW3vmz7O2Pxjw/owOlmo6PKEIxRSeZKv/kuL9itnpYA==",
"dev": true, "dev": true,
"license": "MIT",
"bin": { "bin": {
"ncc": "dist/ncc/cli.js" "ncc": "dist/ncc/cli.js"
} }
@ -5933,9 +5932,9 @@
} }
}, },
"node_modules/docker-compose": { "node_modules/docker-compose": {
"version": "1.3.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/docker-compose/-/docker-compose-1.3.0.tgz", "resolved": "https://registry.npmjs.org/docker-compose/-/docker-compose-1.2.0.tgz",
"integrity": "sha512-7Gevk/5eGD50+eMD+XDnFnOrruFkL0kSd7jEG4cjmqweDSUhB7i0g8is/nBdVpl+Bx338SqIB2GLKm32M+Vs6g==", "integrity": "sha512-wIU1eHk3Op7dFgELRdmOYlPYS4gP8HhH1ZmZa13QZF59y0fblzFDFmKPhyc05phCy2hze9OEvNZAsoljrs+72w==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"yaml": "^2.2.2" "yaml": "^2.2.2"

View File

@ -28,11 +28,11 @@
"@actions/github": "^6.0.1", "@actions/github": "^6.0.1",
"@actions/tool-cache": "^2.0.2", "@actions/tool-cache": "^2.0.2",
"@octokit/action": "^8.0.2", "@octokit/action": "^8.0.2",
"docker-compose": "^1.3.0" "docker-compose": "^1.2.0"
}, },
"devDependencies": { "devDependencies": {
"@ts-dev-tools/core": "^1.9.6", "@ts-dev-tools/core": "^1.9.5",
"@vercel/ncc": "^0.38.4", "@vercel/ncc": "^0.38.3",
"eslint-plugin-github": "^6.0.0", "eslint-plugin-github": "^6.0.0",
"eslint-plugin-jsonc": "^2.20.1" "eslint-plugin-jsonc": "^2.20.1"
}, },