Skip to content

Commit

Permalink
Update publish to docker workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
aecelaya committed Sep 20, 2024
1 parent 2b55f7e commit 4ddfbf9
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: Publish Docker Images

on:
workflow_dispatch:

# TODO: Docker images are too large right now. Fix this later.
# workflow_run:
# workflows: [Upload Python Package]
# types: [completed]
workflow_run:
workflows: [Upload Python Package]
types: [completed]

jobs:
push_to_registry:
Expand All @@ -25,23 +14,31 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Extract and transform version from pyproject.toml
id: extract_version
run: |
VERSION=$(grep -m1 -Po '(?<=version\s?=\s?")[^"]*' pyproject.toml)
# Replace "-alpha" with "a0", "-beta" with "b0", and so on
DOCKER_VERSION=$(echo $VERSION | sed 's/-alpha/a0/' | sed 's/-beta/b0/' | sed 's/-rc/rc0/')
echo "DOCKER_VERSION=$DOCKER_VERSION" >> $GITHUB_ENV
- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: mistmedical/mist

- name: Build and push Docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
tags: |
mistmedical/mist:${{ env.DOCKER_VERSION }}
mistmedical/mist:latest

0 comments on commit 4ddfbf9

Please sign in to comment.