Skip to content

Commit

Permalink
feat(docker build): Pass docker meta creation date as build arg
Browse files Browse the repository at this point in the history
Docker meta action exposes created date which can be passed to service image as a build arg
  • Loading branch information
NazmiAltun committed Dec 6, 2022
1 parent c23b6df commit d946c58
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gflows/libs/steps.lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ with:
#@ end
#@ build_args.append("COMMIT_SHA=${{ github.sha }}")
#@ if build_versioned_image:
#@ build_args.append("BUILD_DATETIME=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}")
#@ build_args.append("APP_VERSION=${{ needs.version.outputs.app_version }}")
#@ build_args.append("FILE_VERSION=${{ needs.version.outputs.file_version }}")
#@ build_args.append("INFORMATIONAL_VERSION=${{ needs.version.outputs.information_version }}")
Expand Down
4 changes: 4 additions & 0 deletions github-sample/workflows/build-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ jobs:
type=registry,ref=ghcr.io/covergo/auth-nuget-cache:${{ needs.version.outputs.issue_id_slug }}
build-args: |-
COMMIT_SHA=${{ github.sha }}
BUILD_DATETIME=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
APP_VERSION=${{ needs.version.outputs.app_version }}
FILE_VERSION=${{ needs.version.outputs.file_version }}
INFORMATIONAL_VERSION=${{ needs.version.outputs.information_version }}
Expand Down Expand Up @@ -182,6 +183,7 @@ jobs:
cache-to: type=registry,ref=ghcr.io/covergo/auth-nuget-default-cache:${{ needs.version.outputs.issue_id_slug }},mode=max
build-args: |-
COMMIT_SHA=${{ github.sha }}
BUILD_DATETIME=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
APP_VERSION=${{ needs.version.outputs.app_version }}
FILE_VERSION=${{ needs.version.outputs.file_version }}
INFORMATIONAL_VERSION=${{ needs.version.outputs.information_version }}
Expand Down Expand Up @@ -266,6 +268,7 @@ jobs:
build-args: |-
NOW="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
COMMIT_SHA=${{ github.sha }}
BUILD_DATETIME=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
APP_VERSION=${{ needs.version.outputs.app_version }}
FILE_VERSION=${{ needs.version.outputs.file_version }}
INFORMATIONAL_VERSION=${{ needs.version.outputs.information_version }}
Expand Down Expand Up @@ -314,6 +317,7 @@ jobs:
target: build-predeployment
build-args: |-
COMMIT_SHA=${{ github.sha }}
BUILD_DATETIME=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
APP_VERSION=${{ needs.version.outputs.app_version }}
FILE_VERSION=${{ needs.version.outputs.file_version }}
INFORMATIONAL_VERSION=${{ needs.version.outputs.information_version }}
Expand Down

0 comments on commit d946c58

Please sign in to comment.