Skip to content

CI: add docker images #7

CI: add docker images

CI: add docker images #7

Workflow file for this run

# -*- coding: utf-8 -*-
# Copyright 2021 United Kingdom Research and Innovation
# Copyright 2021 The University of Manchester
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Authors:
# CIL Developers, listed at: https://github.com/TomographicImaging/CIL/blob/master/NOTICE.txt
name: build
on:
release:
types: [published]
push:
branches: [master]
tags: ['**']
paths-ignore:
- 'CHANGELOG.md'
- 'CITATION.cff'
- 'LICENSE'
- 'scripts/**'
- 'NOTICE.txt'
- 'README.md'
pull_request:
branches: [master]
paths-ignore:
- 'CHANGELOG.md'
- 'CITATION.cff'
- 'LICENSE'
- 'scripts/**'
- 'NOTICE.txt'
- 'README.md'
jobs:
conda:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: conda-build
uses: TomographicImaging/conda-package-publish-action@v2
with:
subDir: recipe
channels: -c conda-forge -c intel -c ccpi
convert_win: false
convert_osx: false
test_pyver: 3.9
test_npver: 1.22
- name: Upload artifact of the conda package
uses: actions/upload-artifact@v3
with:
name: cil-package
path: recipe/linux-64/cil*
docs:
needs: conda
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: ls
- name: Download artifact of the conda package
uses: actions/download-artifact@v3
with:
name: cil-package
path: conda_package
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: 3.9
- uses: lauramurgatroyd/build-sphinx-action@v0.1.4
with:
docs_path: docs
conda_build_env_filepath: docs/docs_environment.yml
artifact_name: DocumentationHTML
package_folder_path: conda_package
package_name: cil
package_conda_channels: conda-forge -c intel -c ccpi
build_subdir_name: nightly
python_version: 3.9
- name: redirect to nightly
run: >
sed 's#DESTINATION#https://tomographicimaging.github.io/CIL/nightly/#g'
docs/.redirect-template.html
> docs/build/index.html
- name: Push changes
if: github.ref == 'refs/heads/master'
uses: casperdcl/push-dir@v1
with:
message: Update documentation
branch: gh-pages
dir: docs/build
nojekyll: true
docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.ref }} # fix SHA
submodules: recursive
- uses: docker/setup-buildx-action@v3
- uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- uses: docker/login-action@v3
if: github.ref == 'refs/heads/master'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build & push
uses: docker/build-push-action@v5
with:
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
push: ${{ github.ref == 'refs/heads/master' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}