Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
| de8fe6333b | |||
| f037e1ac6c | |||
| bddb9fea09 | |||
| 76e2acd9de | |||
| a6a481a269 | |||
| 876b42e2ef | |||
| ee66942853 |
2 changed files with 5 additions and 4 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Works, as long as there is access to `docker` CLI.
|
||||
|
||||
In my workflows, it is being run in the `alpine` linux with `git`, `bash` and `docker-cli` packages installed (see [actions/alpine](https://git.dzuchun.ing/actions/alpine)). Official `docker:cli` image should work too.
|
||||
In my workflows, it is being run in the `alpine` linux with `git`, `bash` and `docker-cli` packages installed (see [actions/docker](https://git.dzuchun.ing/actions/docker)). Official `docker:cli` image should work too.
|
||||
|
||||
## License
|
||||
|
||||
|
|
|
|||
7
main.sh
7
main.sh
|
|
@ -1,16 +1,17 @@
|
|||
#!/bin/bash
|
||||
set -eu -o pipefail
|
||||
|
||||
REGISTRY_URL=$(printenv INPUT_REGISTRY-URL)
|
||||
USER=$(printenv INPUT_REGISTRY-USER)
|
||||
IMAGE=$(printenv INPUT_IMAGE-NAME)
|
||||
# fallback to registry variable
|
||||
IMAGE=${IMAGE:-$FORGEJO_REGISTRY}
|
||||
IMAGE=${IMAGE:-$FORGEJO_REPOSITORY}
|
||||
TAG="$INPUT_TAG"
|
||||
TOKEN="$INPUT_TOKEN"
|
||||
CONTEXT="$GITHUB_WORKSPACE/$INPUT_CONTEXT"
|
||||
|
||||
# strip https:// from the registry url
|
||||
if ! [[ "$REGITRY_URL" =~ ^https:// ]]; then
|
||||
if ! [[ "$REGISTRY_URL" =~ ^https:// ]]; then
|
||||
echo "Only https registry urls are supported now. Provided registry url: $REGISTRY_URL"
|
||||
exit 1
|
||||
fi
|
||||
|
|
@ -22,7 +23,7 @@ echo "Building the image, tag=$IMAGE_TAG"
|
|||
docker build --compress --tag $IMAGE_TAG $CONTEXT
|
||||
|
||||
# log in the registry
|
||||
printenv $TOKEN | docker login -u $USER --password-stdin $REGISTRY_URL
|
||||
echo $TOKEN | docker login -u $USER --password-stdin $REGISTRY_URL
|
||||
|
||||
# push the image
|
||||
docker push $IMAGE_TAG
|
||||
|
|
|
|||
Loading…
Reference in a new issue