Skip to content

ENH: add automated Docker image builds #6

ENH: add automated Docker image builds

ENH: add automated Docker image builds #6

Workflow file for this run

name: CI
on:
pull_request:
branches: ["main"]
push:
branches: ["main"]
jobs:
ci:
uses: qiime2/distributions/.github/workflows/lib-ci-dev.yaml@dev
with:
distro: shotgun
additional-reports-path: ./coverage.xml
additional-reports-name: coverage
coverage:
needs: [ci]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
name: 'Fetch coverage from builds'
with:
name: ${{ needs.ci.outputs.additional-reports-name }}
path: ${{ needs.ci.outputs.additional-reports-path }}
- uses: codecov/codecov-action@v3
name: 'Upload coverage'
with:
fail_ci_if_error: true
build-docker-image:
# needs: [coverage]
runs-on: ubuntu-latest
steps:
- name: Prepare tags
id: prep
run: |
DOCKER_IMAGE="${{ secrets.DOCKER_REPO }}"
TAGS="${DOCKER_IMAGE}:${GITHUB_SHA::8}"
echo ::set-output name=tags::${TAGS}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- name: Print the latest tag
run: echo ${{ github.ref_name }}
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Quay Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker images
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm/v6
push: ${{ github.event.pull_request.merged }}
tags: ${{ steps.prep.outputs.tags }}