Skip to content

Update deprecated env var syntax #28

Update deprecated env var syntax

Update deprecated env var syntax #28

name: Create and publish a Docker image
on:
push:
branches: ['main']
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
include:
- path: ./dockerfiles/guppy-gpu
image: ghcr.io/monashbioinformaticsplatform/containers/guppy-gpu
version: 6.3.8
force: false
- path: ./dockerfiles/masurca
image: ghcr.io/monashbioinformaticsplatform/containers/masurca
version: 4.1.0
force: false
- path: ./dockerfiles/superfreq
image: ghcr.io/monashbioinformaticsplatform/containers/superfreq
version: 1.4.5
force: false
- path: ./dockerfiles/fromassembly2feature
image: ghcr.io/monashbioinformaticsplatform/containers/fromassembly2feature
version: 2.22-a1805f6
force: false
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ matrix.image }}
labels: |
org.opencontainers.image.source=https://github.com/monashbioinformaticsplatform/containers
- name: Get current date
id: datestamp
run: |
echo "datestamp=$(date '+%F.%H%M%S')" >>$GITHUB_ENV
- name: Check if image exists in registry
id: check_image
run: |
IMAGE_TAG="${{ matrix.image }}:${{ matrix.version }}"
if docker manifest inspect ${IMAGE_TAG} > /dev/null 2>&1; then
echo "VERSION_EXISTS=true" >> $GITHUB_ENV
else
echo "VERSION_EXISTS=false" >> $GITHUB_ENV
fi
- name: Build and push Docker image
#uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
uses: docker/build-push-action@v3
if: ${{ env.VERSION_EXISTS == 'false' || matrix.force }}
with:
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
context: ${{ matrix.path }}/${{ matrix.version }}
tags: |
${{ matrix.image }}:${{ matrix.version }}
${{ matrix.image }}:${{ matrix.version }}-${{ github.run_number }}
${{ matrix.image }}:${{ matrix.version }}-${{ env.datestamp }}
labels: ${{ steps.meta.outputs.labels }}
file: ${{ matrix.path }}/${{ matrix.version }}/Dockerfile