Skip to content

Release 3.20

Release 3.20 #160

name: Build container image for GHCR
on:
push:
branches:
- devel
- RELEASE_*
workflow_dispatch:
schedule:
- cron: '0 18 * * 5'
jobs:
build:
strategy:
fail-fast: false
matrix:
base:
- {image: 'rocker/r-ver', amdtag: '4.4.2', armtag: '4.4.2', outname: 'r-ver'}
- {image: 'rocker/rstudio', amdtag: '4.4.2', armtag: '4.4.2', outname: 'bioconductor_docker'}
- {image: 'rocker/tidyverse', amdtag: '4.4.2', armtag: 'N/A', outname: 'tidyverse'}
- {image: 'ghcr.io/bioconductor/rocker-ml-verse', amdtag: '4.4.2', armtag: 'N/A', outname: 'ml-verse'}
- {image: 'rocker/shiny', amdtag: '4.4.2', armtag: 'N/A', outname: 'shiny'}
name: Build branch images
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Free root space
uses: almahmoud/free-root-space@main
with:
verbose: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Dockerhub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata for container image
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ github.repository_owner }}/${{ matrix.base.outname }}
tags: |
type=raw,value={{branch}}
- name: Set comma-separated list with all repository names
id: images
run: |
IMG=${{ steps.meta.outputs.tags }}
REPOLIST="docker.io/$IMG"
REPOLIST="ghcr.io/$IMG,$REPOLIST"
# Add tag with tag 3.xx as well as RELEASE_3_xx
if [[ $IMG = *"RELEASE_"* ]]; then
REPOLIST="$(echo $REPOLIST | sed 's/:RELEASE_3_/:3./g'),$REPOLIST"
fi
# Add tag with R version (based on amd64)
docker pull ${{ matrix.base.image }}:${{ matrix.base.amdtag }}
RVER=$(docker inspect ${{ matrix.base.image }}:${{ matrix.base.amdtag }} | jq -r '.[].Config.Env[]|select(match("^R_VERSION"))|.[index("=")+1:]')
REPOLIST="$(echo $REPOLIST | sed "s/,/-R-$RVER,/g")-R-$RVER,$REPOLIST"
# Also add alternative without _docker when in name
if [[ $REPOLIST == *"_docker"* ]]; then
REPOLIST="$(echo $REPOLIST | sed 's/_docker//g'),$REPOLIST"
fi
echo list=$REPOLIST >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
platforms: linux/amd64,linux/arm64
- name: Build and push container image to all repos both arm64 and amd64
uses: docker/build-push-action@v3
with:
build-args: |
BASE_IMAGE=${{ matrix.base.image }}
arm64_tag=${{ matrix.base.armtag }}
amd64_tag=${{ matrix.base.amdtag }}
file: Dockerfile
push: true
tags: ${{ steps.images.outputs.list }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
if: matrix.base.armtag != 'N/A'
- name: Build and push container image to all repos amd64 only
uses: docker/build-push-action@v3
with:
build-args: |
BASE_IMAGE=${{ matrix.base.image }}
amd64_tag=${{ matrix.base.amdtag }}
file: Dockerfile
push: true
tags: ${{ steps.images.outputs.list }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
if: matrix.base.armtag == 'N/A'