Skip to content

Commit 571e689

Browse files
authored
Merge pull request #2 from yongleyuan/SOFTWARE-4832.separate-docker-registries
Separate out Docker registries (SOFTWARE-4832)
2 parents 851f3c8 + 9253115 commit 571e689

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

action.yml

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,17 @@ inputs:
77
description: 'Input string that gets passed along to the docker build args'
88
required: true
99
tag_list:
10-
description: 'List of tags that gets passed along to the docker build args'
11-
required: true
10+
description: 'List of comma-separated tags that gets passed along to the docker build args'
11+
required: false
1212
default: '' # set to an empty string
13-
docker_username:
14-
description: 'Docker username obtained from secrets'
13+
registry_url:
14+
description: 'URL of the registry'
15+
required: true
16+
registry_user:
17+
description: 'Username of the registry'
1518
required: true
16-
docker_password:
17-
description: 'Docker password obtained from secrets'
19+
registry_pass:
20+
description: 'Password of the registry'
1821
required: true
1922

2023
runs:
@@ -27,23 +30,29 @@ runs:
2730
env:
2831
REPO: ${{ inputs.repo }}
2932
run: |
30-
docker_repo=${GITHUB_REPOSITORY/opensciencegrid\/docker-/opensciencegrid/}
3133
if [ -z "${{ inputs.tag_list }}" ]; then
32-
tag_list=$docker_repo:$REPO,$docker_repo:$(date +%Y%m%d-%H%M)
34+
docker_repo=${GITHUB_REPOSITORY/opensciencegrid\/docker-/opensciencegrid/}
35+
tag_list=()
36+
for image_tag in "$REPO" "$REPO-$(date +%Y%m%d-%H%M)"; do
37+
tag_list+=("${{ inputs.registry_url }}/$docker_repo":"$image_tag")
38+
done
39+
IFS=,
40+
echo "::set-output name=taglist::${tag_list[*]}"
3341
else
34-
tag_list=${{ inputs.tag_list }}
42+
tag_list=$(echo ${{ inputs.tag_list }} | sed -E "s/([^,]+)/${{ inputs.registry_url }}\/\1/g")
43+
echo "::set-output name=taglist::$tag_list"
3544
fi
36-
echo "::set-output name=taglist::$tag_list"
3745
shell: bash
3846

3947
- name: Set up Docker Buildx
4048
uses: docker/setup-buildx-action@v1
4149

42-
- name: Log in to Docker Hub
50+
- name: Log in to ${{ inputs.registry_url }}
4351
uses: docker/login-action@v1
4452
with:
45-
username: ${{ inputs.docker_username }}
46-
password: ${{ inputs.docker_password }}
53+
registry: ${{ inputs.registry_url }}
54+
username: ${{ inputs.registry_user }}
55+
password: ${{ inputs.registry_pass }}
4756

4857
- name: Build image
4958
uses: docker/[email protected]

0 commit comments

Comments
 (0)