Skip to content

Commit

Permalink
fix!: use kebab-case in all inputs and outputs
Browse files Browse the repository at this point in the history
- `build-docker-image`:
  - input docker_args is renamed to docker-args
  - input prune_after is renamed to prune-after
  - outputs tagged_image is renamed to tagged-image
  • Loading branch information
EdieLemoine committed May 18, 2022
1 parent e1be8e3 commit 16f71ba
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ This is a collection of reusable composite actions for GitHub Actions workflows.

1. Sets up php@7.2 with composer v2
- You can change the php version by passing `php-version`.
- You can change the composer version or install any other tools by passing `tools`.
- See [shivammathur/setup-php](https://github.com/shivammathur/setup-php#wrench-tools-support) for supported
values.
- You can change the composer version or install any other tools by
passing `tools`.
See [shivammathur/setup-php](https://github.com/shivammathur/setup-php#wrench-tools-support)
for supported values.
2. Handles cache
3. Runs `composer install --no-interaction --no-progress`
- You can add additional flags by passing the `flags` option.
Expand Down Expand Up @@ -113,7 +114,8 @@ This is a collection of reusable composite actions for GitHub Actions workflows.

[Source](build-docker-image/action.yml)

Builds a docker image from a Dockerfile. Layers are cached and pruned between jobs based on git ref and tag.
Builds a docker image from a Dockerfile. Layers are cached and pruned between
jobs based on git ref and tag.

#### Inputs

Expand All @@ -123,15 +125,15 @@ Builds a docker image from a Dockerfile. Layers are cached and pruned between jo
| Yes | `key` | Cache key | `my-image-${{ hashFiles('Dockerfile') }}` | `${{ github.workflow }}` |
| No | `dockerfile` | Path to dockerfile | `./docker/prod.Dockerfile` | `Dockerfile` |
| No | `context` | Directory to build from | `./docker` | `.` |
| No | `docker_args` | Arguments to pass to docker build | `--target prod` | |
| No | `prune_after` | Amount of time until which images get pruned | `24h` | `260h` (2 weeks) |
| No | `docker-args` | Arguments to pass to docker build | `--target prod` | |
| No | `prune-after` | Amount of time until which images get pruned | `24h` | `260h` (2 weeks) |
| No | `buildkit` | Whether to use Docker BuildKit | `true` | `false` |

#### Outputs

| name | description | Example |
|----------------|-----------------------------|-------------------------------|
| `tagged_image` | Created image name with tag | `my-name/my-image:1639002200` |
| `tagged-image` | Created image name with tag | `my-name/my-image:1639002200` |
| `tag` | Tag of the created image | `1639002200` |

#### Example
Expand All @@ -143,10 +145,10 @@ Builds a docker image from a Dockerfile. Layers are cached and pruned between jo
image: myparcel/php-sdk
dockerfile: Dockerfile
context: .
docker_args: --target test
docker-args: --target test
buildkit: true
- run: docker run ${{ steps.docker.outputs.tagged_image }}
- run: docker run ${{ steps.docker.outputs.tagged-image }}
```

## Releasing
Expand All @@ -155,7 +157,8 @@ Builds a docker image from a Dockerfile. Layers are cached and pruned between jo

[Source](semantic-release/action.yml)

Run semantic release using the MyParcel bot. Requires npm dependencies to be installed.
Run semantic release using the MyParcel bot. Requires npm dependencies to be
installed.

#### Example

Expand Down
18 changes: 9 additions & 9 deletions build-docker-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ inputs:
required: false
default: .

docker_args:
docker-args:
description: 'Arguments to pass to docker build'
required: false
default: ''

prune_after:
prune-after:
description: 'Amount of time after which images get pruned'
required: false
default: '260h'
Expand All @@ -37,9 +37,9 @@ inputs:
default: 'false'

outputs:
tagged_image:
tagged-image:
description: 'Created image name with tag'
value: ${{ steps.prep.outputs.tagged_image }}
value: ${{ steps.prep.outputs.tagged-image }}
tag:
description: 'Tag of the created image'
value: ${{ steps.prep.outputs.tag }}
Expand All @@ -51,11 +51,11 @@ runs:
id: prep
run: |
IMAGE=$(echo ${{ inputs.image }})
ARGS=$(echo ${{ inputs.docker_args }} | shasum | head -c 40)
ARGS=$(echo ${{ inputs.docker-args }} | shasum | head -c 40)
TAG=$(echo $GITHUB_SHA | head -c7)
echo ::set-output name=args::${ARGS}
echo ::set-output name=tag::${TAG}
echo ::set-output name=tagged_image::${IMAGE}:${TAG}
echo ::set-output name=tagged-image::${IMAGE}:${TAG}
shell: bash

- uses: satackey/action-docker-layer-caching@v0.0.11
Expand All @@ -67,11 +67,11 @@ runs:
- name: 'Build image'
shell: bash
run: >
docker build ${{ inputs.docker_args }} \
docker build ${{ inputs.docker-args }} \
--label args=${{ steps.prep.outputs.args }} \
--label ref=${{ github.ref }} \
--label tag=${{ steps.prep.outputs.tag }} \
--tag ${{ steps.prep.outputs.tagged_image }} \
--tag ${{ steps.prep.outputs.tagged-image }} \
--file ${{ inputs.dockerfile }} \
${{ inputs.context }}
env:
Expand All @@ -92,4 +92,4 @@ runs:
run: >
docker image prune \
--force \
--filter "until=${{ inputs.prune_after }}"
--filter "until=${{ inputs.prune-after }}"

0 comments on commit 16f71ba

Please sign in to comment.