File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 11FROM alpine:latest
22RUN apk add --update --no-cache --no-progress curl jq
3- COPY get-next-tag-number .sh /get-next-tag-number .sh
4- ENTRYPOINT ["/get-next-tag-number .sh" ]
3+ COPY action .sh /action .sh
4+ ENTRYPOINT ["/action .sh" ]
Original file line number Diff line number Diff line change 1717 id : next-tag
1818 uses : codebandits/github-actions/next-image-tag-number@main
1919 with :
20- image_repository_url : https:// registry.example.com/v2/my-repo/my- image
20+ image_repository_url : registry.example.com/repository/ image
2121 bearer_token : ${{ secrets.REPO_BEARER_TOKEN }}
2222 initial_number : 100
2323 tag_prefix : build-
2727
2828## Inputs
2929
30- - ` image_repository_url:` **Required.** The URL of the OCI-compatible image repository.
30+ - ` image_repository_url:` **Required.** The URL of the OCI-compatible image repository. If the protocol is omitted, https is assumed.
3131- ` bearer_token:` Optional. The bearer token for repository authentication. Defaults to empty (no authentication).
3232- ` initial_number:` Optional. Starting tag number if no tags exist in the repository. Defaults to 1.
3333- ` tag_prefix:` Optional. Prefix for the tags. Defaults to build-.
Original file line number Diff line number Diff line change 11#! /usr/bin/env sh
22
3- REPOSITORY_URL=$1
3+ if ! echo " $1 " | grep -q " ^http" ; then
4+ IMAGE_REPOSITORY_URL=" https://$1 "
5+ else
6+ IMAGE_REPOSITORY_URL=" $1 "
7+ fi
48BEARER_TOKEN=$2
59INITIAL_NUMBER=${3:- 1}
610TAG_PREFIX=${4:- " build-" }
1115 AUTH_HEADER=" "
1216fi
1317
14- TAGS=$( curl -s $AUTH_HEADER " ${REPOSITORY_URL } /tags/list" | jq -r ' .tags[]' || echo " " )
18+ TAGS=$( curl -s $AUTH_HEADER " ${IMAGE_REPOSITORY_URL } /tags/list" | jq -r ' .tags[]' || echo " " )
1519
1620if [ -z " $TAGS " ]; then
1721 echo " No existing tags were found. Using initial tag number ${INITIAL_NUMBER} ."
You can’t perform that action at this time.
0 commit comments