Merge pull request #2887 from CannonLock/SOFTWARE-5443 #104
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push Docker image | |
on: | |
push: | |
tags: | |
- v[0-9]+.[0-9]+.[0-9]+ | |
- v[0-9]+.[0-9]+.[0-9]+.[0-9]+ | |
- v[0-9]+.[0-9]+.[0-9]+.itb.[0-9]+ | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: startsWith(github.repository, 'opensciencegrid/') | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Generate tag list | |
id: generate-tag-list | |
run: | | |
docker_repo=${GITHUB_REPOSITORY/opensciencegrid\/docker-/opensciencegrid/} | |
tag_list=() | |
for registry in hub.opensciencegrid.org docker.io; do | |
for image_tag in latest "${GITHUB_REF##*/v}"; do | |
tag_list+=("$registry/$docker_repo":"$image_tag") | |
done | |
done | |
# This causes the tag_list array to be comma-separated below, | |
# which is required for build-push-action | |
IFS=, | |
echo "::set-output name=taglist::${tag_list[*]}" | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Log in to OSG Harbor | |
uses: docker/login-action@v1 | |
with: | |
registry: hub.opensciencegrid.org | |
username: ${{ secrets.OSG_HARBOR_ROBOT_USER }} | |
password: ${{ secrets.OSG_HARBOR_ROBOT_PASSWORD }} | |
- name: Build and push Docker images | |
uses: docker/[email protected] | |
with: | |
context: . | |
push: true | |
tags: "${{ steps.generate-tag-list.outputs.taglist }}" |