Skip to content

dispatch-build

dispatch-build #161

name: Build and push container image
on:
push:
pull_request:
repository_dispatch:
types:
- dispatch-build
workflow_dispatch:
jobs:
make-date-tag:
runs-on: ubuntu-latest
outputs:
dtag: ${{ steps.mkdatetag.outputs.dtag }}
steps:
- name: make date tag
id: mkdatetag
run: echo "::set-output name=dtag::$(date +%Y%m%d-%H%M)"
build:
runs-on: ubuntu-latest
needs: [make-date-tag]
strategy:
fail-fast: false
matrix:
osg_series: ['3.6']
repo: ['development', 'testing', 'release']
steps:
- uses: opensciencegrid/[email protected]
with:
osg_series: ${{ matrix.osg_series }}
repo: ${{ matrix.repo }}
timestamp_tag: ${{ needs.make-date-tag.outputs.dtag }}
push:
runs-on: ubuntu-latest
needs: [make-date-tag, build]
if: >-
github.ref == 'refs/heads/main' &&
github.event_name != 'pull_request' &&
github.repository_owner == 'opensciencegrid'
strategy:
matrix:
osg_series: ['3.6']
repo: ['development', 'testing', 'release']
registry:
- url: hub.opensciencegrid.org
username: OSG_HARBOR_ROBOT_USER
password: OSG_HARBOR_ROBOT_PASSWORD
- url: docker.io
username: DOCKER_USERNAME
password: DOCKER_PASSWORD
steps:
- uses: opensciencegrid/[email protected]
with:
osg_series: ${{ matrix.osg_series }}
repo: ${{ matrix.repo }}
timestamp_tag: ${{ needs.make-date-tag.outputs.dtag }}
registry_url: ${{ matrix.registry.url }}
registry_user: ${{ secrets[matrix.registry.username] }}
registry_pass: ${{ secrets[matrix.registry.password] }}