Split workflows
Tag mlflow release / Create mlflow tag (push) Successful in 5s Details

This commit is contained in:
LordMathis 2024-01-31 16:27:52 +01:00
parent a40d221c57
commit f710eac184
2 changed files with 34 additions and 44 deletions

View File

@ -1,52 +1,12 @@
name: Build and push mlflow container
on:
push:
branches:
- main
tags:
- '[0-9]+.[0-9]+.[0-9]+'
jobs:
tag:
name: Create mlflow tag
runs-on: ubuntu-latest
outputs:
tag_created: ${{ steps.create.outputs.created }}
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"
echo "created=false" >> $GITHUB_OUTPUT
else
git tag ${{ steps.mlflow.outputs.mlflow }}
git push origin ${{ steps.mlflow.outputs.mlflow }}
echo "created=true" >> $GITHUB_OUTPUT
fi
debug:
needs: tag
runs-on: ubuntu-latest
steps:
- name: Debug output
run: |
echo "${{ toJson(needs.tag) }}"
build:
name: Build and push mlflow container
needs: tag
if: ${{ needs.tag.outputs.tag_created == 'true' }}
runs-on: ubuntu-latest
container: ghcr.io/catthehacker/ubuntu:act-latest@sha256:07466dbbecd8690579d9bcbf8a1214240b91534cf03eed5f222e7fd80131f582
env:
@ -68,5 +28,4 @@ jobs:
TODAY=$(date +'%Y-%m-%d')
docker build -t ${REGISTRY}/${REPO_OWNER}/${IMAGE_NAME}:${VERSION}-${TODAY} -t ${REGISTRY}/${REPO_OWNER}/${IMAGE_NAME}:latest .
docker push ${REGISTRY}/${REPO_OWNER}/${IMAGE_NAME}:${VERSION}-${TODAY}
docker push ${REGISTRY}/${REPO_OWNER}/${IMAGE_NAME}:latest
docker push ${REGISTRY}/${REPO_OWNER}/${IMAGE_NAME}:latest

31
.gitea/workflows/tag.yaml Normal file
View File

@ -0,0 +1,31 @@
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