Change CI to use the version names in Docker images #8
Workflow file for this run
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: | |
# Always trigger the build on the devel branch | |
- "devel" | |
# Also trigger the build for branches named after release versions like: | |
# 0.1.0, 0.1.1-rc1, or 0.1.1.dev0. | |
# Note that this is not a regex but a glob pattern as documented at: | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet | |
- '[0-9]+.[0-9]+.[0-9]+' | |
- '[0-9]+.[0-9]+.[0-9]+-[a-zA-Z0-9]+' | |
tags: | |
# Also trigger the build for repository tags that look like: | |
# 0.1.0, 0.1.1-rc1, or 0.1.1.dev0 | |
- '[0-9]+.[0-9]+.[0-9]+' | |
- '[0-9]+.[0-9]+.[0-9]+-[a-zA-Z0-9]+' | |
jobs: | |
build-images: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
# Creates metadata and tag names for the images named like alpha-automl:{version}-jupyterhub | |
- name: Extract Docker metadata for [{version}-jupyterhub] image | |
id: meta_full_jupyterhub | |
uses: docker/metadata-action@v4 | |
with: | |
images: ghcr.io/vida-nyu/alpha-automl | |
tags: | | |
type=match,pattern=[0-9]+\.[0-9]+\.[0-9]+.* | |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'devel') }} | |
flavor: | | |
latest=false | |
suffix=-jupyterhub | |
# Creates metadata and tag names for the images named like alpha-automl:{version} | |
- name: Extract Docker metadata for [{version}] image | |
id: meta_full | |
uses: docker/metadata-action@v4 | |
with: | |
images: ghcr.io/vida-nyu/alpha-automl | |
tags: | | |
type=match,pattern=[0-9]+\.[0-9]+\.[0-9]+.* | |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'devel') }} | |
flavor: | | |
latest=false | |
# Builds and pushes images named like alpha-automl:{version}-jupyterhub | |
- name: Build and push JupyterHub image [ghcr.io/vida-nyu/alpha-automl:{version}-jupyterhub] | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./Dockerfile | |
target: alpha-automl-jupyterhub | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta_full_jupyterhub.outputs.tags }} | |
labels: ${{ steps.meta_full_jupyterhub.outputs.labels }} | |
# Builds and pushes images named like alpha-automl:{version} | |
- name: Build and push Jupyter Notebook image [ghcr.io/vida-nyu/alpha-automl:{version}] | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./Dockerfile | |
target: alpha-automl | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta_full.outputs.tags }} | |
labels: ${{ steps.meta_full.outputs.labels }} | |