Skip to content

Commit

Permalink
feat: provide default tags if none are provided by the user
Browse files Browse the repository at this point in the history
  • Loading branch information
iloveitaly committed Jun 9, 2024
1 parent de5f423 commit 23af643
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,8 @@ runs:
INPUT_APT: ${{ inputs.apt }}
INPUT_PUSH: ${{ inputs.push }}
INPUT_ENV: ${{ inputs.env }}
GITHUB_REPOSITORY: ${{ github.server_url }}/${{ github.repository }}

GIT_SHA: ${{ github.sha }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_REPOSITORY_URL: ${{ github.server_url }}/${{ github.repository }}

8 changes: 6 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ if [ -n "${INPUT_TAGS}" ]; then
for tag in "${TAGS[@]}"; do
BUILD_CMD="$BUILD_CMD --tag $tag"
done
else
# if not tags are provided, assume ghcr.io as the default registry
echo "No tags provided. Defaulting to ghcr.io registry."
BUILD_DATE_TIMESTAMP=$(date +%s)
BUILD_CMD="$BUILD_CMD --tag ghcr.io/$GITHUB_REPOSITORY:$GIT_SHA --tag ghcr.io/$GITHUB_REPOSITORY:latest --tag ghcr.io/$GITHUB_REPOSITORY:$BUILD_DATE_TIMESTAMP"
fi


BUILD_CMD="$BUILD_CMD --label org.opencontainers.image.source=$GITHUB_REPOSITORY"
BUILD_CMD="$BUILD_CMD --label org.opencontainers.image.source=$GITHUB_REPOSITORY_URL"
# TODO add the description label as well

if [ -n "${INPUT_LABELS}" ]; then
Expand Down

0 comments on commit 23af643

Please sign in to comment.