Skip to content

Test quay push

Test quay push #11

name: Build image
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
paths:
- 'images/build-env/**'
- '.github/workflows/build-env-image.yml'
push:
branches:
- 'test-push'
paths:
- 'images/build-env/**'
- '.github/workflows/build-env-image.yml'
env:
MAJOR_VERSION: 3
MINOR_VERSION: 0
jobs:
build:
name: Build image - ${{ matrix.image }}
runs-on: ubuntu-22.04
outputs:
tags: ${{ steps.test.outputs.tags }}
strategy:
matrix:
include:
- arch: arm64
image: bioconda/tmp-bioconda-utils-build-env-cos7-aarch64
base_image: quay.io/condaforge/linux-anvil-aarch64
- arch: amd64
image: bioconda/tmp-bioconda-utils-build-env-cos7-x86_64
base_image: quay.io/condaforge/linux-anvil-cos7-x86_64
steps:
- name: Checkout bioconda-containers
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout bioconda-utils
uses: actions/checkout@v4
with:
fetch-depth: 0
repository: 'bioconda/bioconda-utils'
path: 'bioconda-utils'
- name: Install QEMU dependency
if: ${{ matrix.arch != 'amd64' }}
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ matrix.arch }}
- name: Build image
id: buildah-build
uses: redhat-actions/buildah-build@v2
with:
image: ${{ matrix.image }}
arch: ${{ matrix.arch }}
build-args: |
BASE_IMAGE=${{ matrix.base_image }}
tags: >-
latest
${{ env.MAJOR_VERSION }}
${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}
dockerfiles: |
./images/build-env/Dockerfile
- name: Test built image
id: test
run: |
image='${{ steps.buildah-build.outputs.image }}'
for tag in ${{ steps.buildah-build.outputs.tags }} ; do
podman run --rm "${image}:${tag}" bioconda-utils --version
done
tags_json=$(echo -n "${{ steps.buildah-build.outputs.tags }}" | jq --compact-output --raw-input --slurp 'split(" ")')
echo "tags=${tags_json}" >> $GITHUB_OUTPUT
- name: Push To Quay
if: github.ref == 'refs/heads/test-push' && github.repository == 'bioconda/bioconda-containers'
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.buildah-build.outputs.image }}
tags: ${{ steps.buildah-build.outputs.tags }}
registry: ${{ secrets.QUAY_BIOCONDA_REPO }}
username: ${{ secrets.QUAY_BIOCONDA_USERNAME }}
password: ${{ secrets.QUAY_BIOCONDA_TOKEN }}
build-manifest:
needs: [build]
if: github.ref == 'refs/heads/main' && github.repository == 'bioconda/bioconda-containers'
name: Build and push Docker manifest
runs-on: ubuntu-22.04
env:
DOCKER_MANIFEST: bioconda-utils-build-env-cos7
DOCKER_IMAGES: "quay.io/<<USER>>/bioconda-utils-build-env-cos7:<<TAG>>,quay.io/<<USER>>/bioconda-utils-build-env-cos7-aarch64:<<TAG>>"
strategy:
fail-fast: true
matrix:
tag: ${{ fromJson(needs.build.outputs.tags) }}
steps:
- uses: actions/checkout@v4
- name: Interpolate placeholders
id: interpolate
run: |
set -x
INTERPOLATED=`echo "${{ env.DOCKER_IMAGES }}" | sed "s#<<USER>>#${{ secrets.QUAY_BIOCONDA_USERNAME }}#g" | sed "s#<<TAG>>#${{ matrix.tag }}#g"`
echo "DOCKER_IMAGES=${INTERPOLATED}" >> "$GITHUB_OUTPUT"
- name: Login to Quay.io registry
uses: docker/login-action@v2
with:
registry: ${{ secrets.QUAY_BIOCONDA_REPO }}
username: ${{ secrets.QUAY_BIOCONDA_USERNAME }}
password: ${{ secrets.QUAY_BIOCONDA_TOKEN }}
- name: Push Docker manifest list for quay.io/bioconda
run: |
PREFIX=${{ secrets.QUAY_BIOCONDA_REPO }}/${{ secrets.QUAY_BIOCONDA_USERNAME }}
docker manifest create ${PREFIX}/${{ env.DOCKER_MANIFEST }}:${{ matrix.tag }} \
--amend ${PREFIX}/bioconda-utils-build-env-cos7-x86_64:${{ matrix.tag }} \
--amend ${PREFIX}/bioconda-utils-build-env-cos7-aarch64:${{ matrix.tag }}
docker manifest inspect ${PREFIX}/${{ env.DOCKER_MANIFEST }}:${{ matrix.tag }}
docker manifest push ${PREFIX}/${{ env.DOCKER_MANIFEST }}:${{ matrix.tag }}