Skip to content

Throw an error, do not just log an error, if provided schema is not legit #148

Throw an error, do not just log an error, if provided schema is not legit

Throw an error, do not just log an error, if provided schema is not legit #148

name: Docker
on:
push:
branches: [main, dev]
tags: ['*']
pull_request:
branches: [main, dev]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v5
with:
fetch-depth: 200
filter: blob:none
# fetch-tags: true breaks on tags
fetch-tags: ${{ !startsWith(github.ref, 'refs/tags/') }}
- name: Log in to Docker Hub
if: github.event_name == 'push'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: bids/validator
- name: Build ${{ startsWith(github.ref, 'refs/tags/') && 'and push' || '' }} ${{ steps.meta.outputs.tags }}
uses: docker/build-push-action@v6
with:
context: .
push: ${{ startsWith(github.ref, 'refs/tags/') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Verify Docker image
run: docker run --rm ${{ fromJSON(steps.meta.outputs.json).tags[0] }} --version