Use conditional steps
Build and push mlflow container / Build and push mlflow container (push) Successful in 4m16s Details

This commit is contained in:
LordMathis 2024-01-31 16:42:29 +01:00
parent f710eac184
commit ad639009d8
2 changed files with 23 additions and 33 deletions

View File

@ -1,8 +1,8 @@
name: Build and push mlflow container
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
branches:
- main
jobs:
build:
@ -16,13 +16,34 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Fetch tags
run: git fetch --tags origin
- name: Get mlflow version
id: mlflow
run: |
mlflow=$(cat requirements.txt | grep mlflow | cut -d'=' -f3)
echo $mlflow
echo "mlflow=$mlflow" >> $GITHUB_OUTPUT
- name: Create tag if it doesn't exist
id: create
run: |
if git rev-parse "refs/tags/${{ steps.mlflow.outputs.mlflow }}" 2>/dev/null; then
echo "Tag already exists"
echo "tag_exists=true" >> $GITHUB_OUTPUT
else
git tag ${{ steps.mlflow.outputs.mlflow }}
git push origin ${{ steps.mlflow.outputs.mlflow }}
echo "tag_exists=false" >> $GITHUB_OUTPUT
fi
- name: Login to Registry
uses: docker/login-action@v3
if: steps.create.outputs.tag_exists == 'false'
with:
registry: git.namesny.com
username: ${{ gitea.actor }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build and push
if: steps.create.outputs.tag_exists == 'false'
run: |
VERSION=$(cat requirements.txt | grep mlflow | cut -d'=' -f3)
TODAY=$(date +'%Y-%m-%d')

View File

@ -1,31 +0,0 @@
name: Tag mlflow release
on:
push:
branches:
- main
jobs:
tag:
name: Create mlflow tag
runs-on: ubuntu-latest
container: ghcr.io/catthehacker/ubuntu:act-latest@sha256:8583ed2b7d097609ff91cc914696324ee945ceb8639967759f4cebbfcb8e63a5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Fetch tags
run: git fetch --tags origin
- name: Get mlflow version
id: mlflow
run: |
mlflow=$(cat requirements.txt | grep mlflow | cut -d'=' -f3)
echo $mlflow
echo "mlflow=$mlflow" >> $GITHUB_OUTPUT
- name: Create tag if it doesn't exist
id: create
run: |
if git rev-parse "refs/tags/${{ steps.mlflow.outputs.mlflow }}" 2>/dev/null; then
echo "Tag already exists"
else
git tag ${{ steps.mlflow.outputs.mlflow }}
git push origin ${{ steps.mlflow.outputs.mlflow }}
fi