Skip to content

Commit

Permalink
updated cicd workflow template
Browse files Browse the repository at this point in the history
  • Loading branch information
Tibor Mach committed Nov 16, 2023
1 parent 7700f9d commit 71c67f2
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions content/docs/start/model-management/model-cicd.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,13 @@ You can now use the following template to create your own Model Registry CICD
actions on GitHub!

```yaml
name: Template CICD Action for DVC Model Registry
name: Deploy Model (Template)
on:
# the workflow is triggered whenever a tag is pushed to the repository
push:
tags:
- "*"
jobs:
# This job parses the git tag with the GTO GitHub Action to identify model registry actions
Expand All @@ -218,18 +217,23 @@ jobs:
stage: ${{ steps.gto.outputs.stage }}
version: ${{ steps.gto.outputs.version }}
perform-action-with-model:
deploy-model:
needs: parse
if: # here paste the model registry event condition you want to trigger your action
# using the outputs from the "parse" job, we run this job only for actions
# in the model registry and only when the model was assigned to a stage called "prod"
# You can replace this with your own conditions
if: ${{ needs.parse.outputs.event == 'assignment' && needs.parse.outputs.stage == 'prod' }}
runs-on: ubuntu-latest
steps:
- uses: iterative/setup-dvc@v1
# this step uses DVC to download the model artifact from our remote repository so we can perform CICD actions with it
# The DVC Studio token is used to avoid having to store specific remote storage credentials on GitHub
- name: Get Model For Deployment
run: |
dvc config --global studio.token ${{ secrets.DVC_STUDIO_TOKEN }}
dvc artifacts get ${{ github.server_url }}/${{ github.repository }} ${{ needs.parse.outputs.name }} --rev ${{ needs.parse.outputs.version }}
...
# this step uses DVC to download the model from the remote repository and deploys the model
# Model deployment is mocked here as it is specific to each deployment environment
# The DVC Studio token is used to avoid having to store specific remote storage credentials on GitHub
- name: Get Model For Deployment
run: |
dvc config --global studio.token ${{ secrets.DVC_STUDIO_TOKEN }}
dvc artifacts get ${{ github.server_url }}/${{ github.repository }} ${{ needs.parse.outputs.name }} --rev ${{ needs.parse.outputs.version }}
echo "The right model is available and you can use the rest of this command to deploy it. Good job!"
```

0 comments on commit 71c67f2

Please sign in to comment.