Move the Github Actions workflow and Dockerfile from bioconda-utils repo #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
jobs: | |
build: | |
name: Build image - ${{ matrix.image }} | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
include: | |
- arch: arm64 | |
image: bioconda-utils-build-env-cos7-aarch64 | |
base_image: quay.io/condaforge/linux-anvil-aarch64 | |
- arch: amd64 | |
image: bioconda-utils-build-env-cos7 | |
base_image: quay.io/condaforge/linux-anvil-cos7-x86_64 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
repository: 'bioconda/bioconda-utils' | |
path: 'bioconda-utils' | |
- id: get-tag | |
run: | | |
tag=${{ github.event.release && github.event.release.tag_name || github.sha }} | |
printf %s "tag=${tag#v}" >> $GITHUB_OUTPUT | |
- name: Install qemu dependency | |
if: ${{ matrix.arch == 'arm64' }} | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: arm64 | |
- 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 | |
${{ steps.get-tag.outputs.tag }} | |
dockerfiles: | | |
./images/build-env/Dockerfile | |
- name: Test built image | |
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 | |
- name: Push To Quay | |
# if: github.ref == 'refs/heads/main' && 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 }} | |
registry: quay.io | |
username: mgrigorov | |
password: ${{ secrets.QUAY_PASSWORD }} | |
build-manifest: | |
needs: [build] | |
# if: github.ref == 'refs/heads/main' && github.repository == 'bioconda/bioconda-containers' | |
name: ${{ matrix.docker-registry }}/${{ matrix.cfg.DOCKER_MANIFEST }}:${{ matrix.cfg.DOCKER_TAG }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
# docker-registry: [quay.io/bioconda] | |
docker-registry: [quay.io/mgrigorov] | |
cfg: | |
# TODO: What name to use for the manifest list ? | |
- DOCKER_MANIFEST: bioconda-utils-build-env-cos7 | |
DOCKER_TAG: "latest" | |
DOCKER_IMAGES: "<<ORG>>/bioconda-utils-build-env-cos7:<<TAG>>,<<ORG>>/bioconda-utils-build-env-cos7-aarch64:<<TAG>>" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Interpolate placeholders | |
id: interpolate | |
env: | |
docker-registry: quay.io/bioconda | |
run: | | |
set -x | |
INTERPOLATED=`echo "${{ matrix.cfg.DOCKER_IMAGES }}" | sed "s#<<ORG>>#${{ env.docker-registry }}#g" | sed "s#<<TAG>>#${{ matrix.cfg.DOCKER_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 }} | |
registry: quay.io | |
username: mgrigorov | |
password: ${{ secrets.QUAY_PASSWORD }} | |
- name: Push Docker manifest list for ${{ matrix.docker-registry }} | |
uses: Noelware/[email protected] | |
with: | |
inputs: ${{ matrix.docker-registry }}/${{ matrix.cfg.DOCKER_MANIFEST }}:${{ matrix.cfg.DOCKER_TAG }} | |
images: ${{ steps.interpolate.outputs.DOCKER_IMAGES }} | |
push: true | |