Merge pull request #3 from TGSAI/release-0.5.3 #25
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: Docker Build | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "*" | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
release: "0.5.3" | |
defaultpython: "3.11" | |
strategy: | |
fail-fast: false | |
matrix: | |
python: ["3.9", "3.10", "3.11"] | |
image: | |
- tag: "ghcr.io/tgsai/mdio" | |
context: "./base" | |
- tag: "ghcr.io/tgsai/mdio-dask" | |
context: "./dask" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
if: github.repository == 'tgsai/mdio-docker' && github.event_name == 'push' | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Generate tags | |
id: tags | |
env: | |
image: ${{ matrix.image.tag }} | |
python: ${{ matrix.python }} | |
stable: ${{ startsWith(github.ref, 'refs/tags') }} | |
run: | | |
if [ "$stable" == "true" ]; then | |
tag="${image}:${release}-py${python}" | |
tags=${image}:latest-py${python},$tag | |
if [ "$python" == "$defaultpython" ]; then | |
tags=${image}:latest,${image}:${release},$tags | |
fi | |
else | |
tag="${image}:dev-py${python}" | |
tags=$tag | |
if [ "$python" == "$defaultpython" ]; then | |
tags=${image}:dev,$tags | |
fi | |
fi | |
echo "::set-output name=tags::${tags}" | |
echo "::set-output name=tag::${tag}" | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: ${{ matrix.image.context }} | |
push: ${{ github.repository == 'tgsai/mdio-docker' && github.event_name == 'push' }} | |
platforms: linux/amd64 | |
tags: ${{ steps.tags.outputs.tags }} | |
build-args: | | |
python=${{ matrix.python }} | |
release=${{ env.release }} | |
- name: Report | |
run: echo Built ${{ steps.tags.outputs.tags }} |