Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

Promote a newly-published container image to latest, based on semver comparison

License

Notifications You must be signed in to change notification settings

monumentalco/latest-image-action

 
 

Repository files navigation

Latest image action

If you work on a project that publishes Docker images, you can add this action to your workflow to keep the Docker latest tag up to date.

Set either a label or ENV var containing your package’s version on your Docker images, and this action will update the latest tag only if the new version is actually newer (according to semver). This means that (e.g.) if you publish a patch release 1.2.4, but latest is 1.3.0, then latest won’t be “updated” to 1.2.4.

Note that the latest tag must already exist; this action will not create the tag initially.

Local Docker authentication is used; any existing Docker auth action that you’re already using like docker/login-action or AWS ECR login should work for this action, too.

- uses: silverlyra/latest-image-action
  with:
    repository: your/project
    candidate-tag: ${{ github.ref_name }}

Inputs

The following inputs are available on the action:

repository (required) 👈

The Docker image repository to update. If you image is published to multiple repositories, you can list each one on its own line:

- uses: silverlyra/latest-image-action
  with:
    repository: |
      some/project
      ghcr.io/some/project/project

candidate-tag (required) 👈

The Docker image tag that should (maybe) be promoted to latest.

This tag must be available in your workflow context, either as a Git tag name (${{ github.ref_name }}), or an output from a prior step.

with:
  candidate-tag: ${{ steps.current_version.outputs.version }}

latest-tag

default: latest

The Docker image tag to (conditionally) update.

version-source

default: label:org.opencontainers.image.version

Where the software version can be found in your Docker image metadata.

Use label:... to read an image label, or env:... to read a preset ENV var.

The default uses the version label from OpenContainers.

promote-prerelease

default: false

Allow a pre-release (e.g., alpha, beta, release-candidate) version to replace a non-pre-release latest.

coerce-semver

default: false

Use a coercing semver parser.

manifest-platform

default: linux/amd64

When updating a tag that points to a multi-arch manifest list (or OCI index), read the image configuration from the manifest for this platform.

Outputs

The action will set these outputs:

updated

Set to true if the latest tag was updated; false if not.

latest-version

Set to the version detected from the latest tag.

candidate-version

Set to the version detected from the candidate tag.

About

Promote a newly-published container image to latest, based on semver comparison

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 97.5%
  • JavaScript 2.5%