Skip to content

Commit 851f3c8

Browse files
authored
Merge pull request #1 from yongleyuan/SOFTWARE-4730
Develop OSG push container composite run steps (SOFTWARE-4730)
2 parents a71119b + 66468a3 commit 851f3c8

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

action.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: 'Push Container Action'
2+
3+
description: 'Push built images to Docker Hub/OSG Harbor'
4+
5+
inputs:
6+
repo:
7+
description: 'Input string that gets passed along to the docker build args'
8+
required: true
9+
tag_list:
10+
description: 'List of tags that gets passed along to the docker build args'
11+
required: true
12+
default: '' # set to an empty string
13+
docker_username:
14+
description: 'Docker username obtained from secrets'
15+
required: true
16+
docker_password:
17+
description: 'Docker password obtained from secrets'
18+
required: true
19+
20+
runs:
21+
using: "composite"
22+
steps:
23+
- uses: actions/checkout@v2
24+
25+
- name: Generate tag list
26+
id: generate-tag-list
27+
env:
28+
REPO: ${{ inputs.repo }}
29+
run: |
30+
docker_repo=${GITHUB_REPOSITORY/opensciencegrid\/docker-/opensciencegrid/}
31+
if [ -z "${{ inputs.tag_list }}" ]; then
32+
tag_list=$docker_repo:$REPO,$docker_repo:$(date +%Y%m%d-%H%M)
33+
else
34+
tag_list=${{ inputs.tag_list }}
35+
fi
36+
echo "::set-output name=taglist::$tag_list"
37+
shell: bash
38+
39+
- name: Set up Docker Buildx
40+
uses: docker/setup-buildx-action@v1
41+
42+
- name: Log in to Docker Hub
43+
uses: docker/login-action@v1
44+
with:
45+
username: ${{ inputs.docker_username }}
46+
password: ${{ inputs.docker_password }}
47+
48+
- name: Build image
49+
uses: docker/[email protected]
50+
with:
51+
push: true
52+
build-args: BASE_YUM_REPO=${{ inputs.repo }}
53+
tags: "${{ steps.generate-tag-list.outputs.taglist }}"
54+
cache-from: type=local,src=/tmp/.buildx-cache
55+

0 commit comments

Comments
 (0)