Skip to content

Commit

Permalink
The version cannot be used as an input
Browse files Browse the repository at this point in the history
  • Loading branch information
gvegayon committed Dec 16, 2024
1 parent 5a9c9f5 commit ba1acb2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
6 changes: 2 additions & 4 deletions twostep-container-build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ flowchart LR
Containerfile2-->|Generates|Image2
```

Caching is done using the [actions/cache](https://github.com/actions/cache/tree/v4) (lookup only) and [docker/build-push-action](https://github.com/docker/build-push-action) actions. Users have to explicitly provide the cache key for the first step. For example, if you are dealing with an R package, you can cache the dependencies by passing the key `${{ hashFiles('DESCRIPTION') }}` to the `first-step-cache-key` input. That way, the first step will only be executed if the dependencies change.
Caching is done using the [actions/cache](https://github.com/actions/cache/tree/v4) (lookup only) and [docker/build-push-action@v6](https://github.com/docker/build-push-action/tree/v6) actions. Users have to explicitly provide the cache key for the first step. For example, if you are dealing with an R package, you can cache the dependencies by passing the key `${{ hashFiles('DESCRIPTION') }}` to the `first-step-cache-key` input. That way, the first step will only be executed if the dependencies change.

## Inputs

Expand All @@ -25,16 +25,14 @@ Caching is done using the [actions/cache](https://github.com/actions/cache/tree/
| `main-branch-name` | Name of the main branch | false | `'main'` |
| `main-branch-tag` | Tag to use for the main branch | false | `'latest'` |

The following are arguments passed to the [docker/build-push-action](https://github.com/docker/build-push-action) action.
The following are arguments passed to the [docker/build-push-action@v6](https://github.com/docker/build-push-action/tree/v6) action.

| Field | Description | Required | Default |
|-------|-------------|----------|---------|
| `push-image-1` | Push the image created during the first step | false | `false` |
| `push-image-2` | Push the image created during the second step | false | `false` |
| `build-args-1` | Build arguments for the first step | false | |
| `build-args-2` | Build arguments for the second step | false | |
| `docker-login-action` | Version of the [docker/login-action](https://github.com/docker/login-action) to use | false | `'v3'` |
| `docker-build-push-action` | Version of the [docker/build-push-action](https://github.com/docker/build-push-action) to use | false | `'v6'` |


## Example: Using ghcr.io
Expand Down
16 changes: 3 additions & 13 deletions twostep-container-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,6 @@ inputs:
description: |
The build arguments to use for the second image.
required: false
docker-login-action-version:
description: |
The version of the docker/login-action to use.
required: false
default: 'v3'
docker-build-push-action-version:
description: |
The version of the docker/build-push-action to use.
required: false
default: 'v6'
runs:
using: 'composite'

Expand Down Expand Up @@ -119,15 +109,15 @@ runs:

- name: Login to the Container Registry
if: inputs.registry != ''
uses: docker/login-action@${{ inputs.docker-login-action-version }}
uses: docker/login-action@v3
with:
registry: ${{ inputs.registry }}
username: ${{ inputs.username }}
password: ${{ inputs.password }}

- name: Build and push
if: steps.cache.outputs.cache-hit != 'true'
uses: docker/build-push-action@${{ inputs.docker-build-push-action-version }}
uses: docker/build-push-action@v6
with:
no-cache: true
push: ${{ inputs.push-image-1 }}
Expand All @@ -139,7 +129,7 @@ runs:

- name: Build and push the main image
id: build_and_push_model_image
uses: docker/build-push-action@${{ inputs.docker-build-push-action-version }}
uses: docker/build-push-action@v6
with:
no-cache: true
push: ${{ inputs.push-image-2 }}
Expand Down

0 comments on commit ba1acb2

Please sign in to comment.