Skip to content

Version 1.0.0-b.1

Version 1.0.0-b.1 #37

Workflow file for this run

# On push: build latest images
name: CI
on:
push:
branches: [ master ]
tags:
- "v?[0-9]+.[0-9]+.[0-9]+*"
paths:
- '.github/**'
- '**.rs'
- 'Cargo.*'
- 'justfile'
- 'Dockerfile'
- 'docker-compose.yml'
- 'run.sh'
pull_request:
branches: [ master ]
jobs:
test:
name: Test
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: FNNDSC/miniChRIS-docker@master
- uses: taiki-e/install-action@v2
with:
tool: just
- name: Start Orthanc and download example data
run: just orthanc
- name: Integration test
run: just test
build:
name: Build
runs-on: ubuntu-22.04
steps:
- name: Decide image tags
id: info
shell: python
run: |
import os
import itertools
def join_tag(t):
registry, repo, tag = t
return f'{registry}/{repo}:{tag}'.lower()
registries = ['docker.io', 'ghcr.io']
repos = ['${{ github.repository }}'.lower()]
if '${{ github.ref_type }}' == 'branch':
tags = ['latest']
elif '${{ github.ref_type }}' == 'tag':
tag = '${{ github.ref_name }}'
version = tag[1:] if tag.startswith('v') else tag
tags = ['latest', version]
else:
tags = []
product = itertools.product(registries, repos, tags)
tags_csv = ','.join(map(join_tag, product))
outputs = {
'tags_csv' : tags_csv,
}
with open(os.environ['GITHUB_OUTPUT'], 'a') as out:
for k, v in outputs.items():
out.write(f'{k}={v}\n')
- uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: github.event_name == 'push' || github.event_name == 'release'
id: dockerhub_login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GitHub Container Registry
if: github.event_name == 'push' || github.event_name == 'release'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
uses: docker/build-push-action@v5
id: docker_build
with:
tags: ${{ steps.info.outputs.tags_csv }}
push: true
cache-from: type=gha
cache-to: type=gha,mode=max