From 4ddfbf9e62ad922ab1de0e061d69daac25bc0e89 Mon Sep 17 00:00:00 2001 From: aecelaya Date: Thu, 19 Sep 2024 23:58:48 -0500 Subject: [PATCH] Update publish to docker workflow. --- .github/workflows/docker-publish.yml | 41 +++++++++++++--------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 7f6bb30..2549fec 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -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: @@ -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