Skip to content

version 4.1.4

version 4.1.4 #24

name: Build & Deploy Docker Containers
on:
# Build on push to any branch
push: []
jobs:
deploy-images:
runs-on: ubuntu-latest
strategy:
fail-fast: false
# Just build primary Dockerfile, tag, arm and amd64 for now
matrix:
dockerfile: [[Dockerfile, linux/amd64, '']]
name: Build ${{ matrix.dockerfile[0] }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set Container Tag
run: |
branch=$(echo ${GITHUB_REF##*/})
printf "Branch is ${branch}\n"
tagged="quay.io/singularity/docker2singularity:${branch}${{ matrix.dockerfile[2] }}"
if [[ "${branch}" == "master" ]]; then
container="quay.io/singularity/docker2singularity:latest${{ matrix.dockerfile[2] }}"
else
container=${tagged}
fi
echo "container=${container}" >> $GITHUB_ENV
echo "branch=${branch}" >> $GITHUB_ENV
echo "tagged=${tagged}" >> $GITHUB_ENV
- name: Log in to Quay Container Registry
if: github.event_name == 'push'
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Inspect Container Names
run: |
printf "Tagged: ${tagged}\n"
printf "Container: ${container}\n"
- name: Build
uses: docker/build-push-action@v3
if: github.event_name != 'push'
with:
file: ${{matrix.dockerfile[0]}}
platforms: ${{ matrix.dockerfile[1] }}
push: false
tags: |
${{ env.container }}
${{ env.tagged }}
- name: Build & Deploy
uses: docker/build-push-action@v3
if: github.event_name == 'push'
with:
file: ${{matrix.dockerfile[0]}}
platforms: ${{ matrix.dockerfile[1] }}
push: true
tags: |
${{ env.container }}
${{ env.tagged }}