mlflow/.gitea/workflows/release.yaml

51 lines
1.8 KiB
YAML

name: Build and push mlflow container
on:
push:
branches:
- main
jobs:
build:
name: Build and push mlflow container
runs-on: ubuntu-latest
container: git.namesny.com/cluster/act-runner:v1@sha256:12ecb5835cd38f38bf9fc7589abc3751861bd737c612bb2a6194615810cb4f92
env:
IMAGE_NAME: mlflow
REGISTRY: git.namesny.com
REPO_OWNER: cluster
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)
docker build -t ${REGISTRY}/${REPO_OWNER}/${IMAGE_NAME}:${VERSION} -t ${REGISTRY}/${REPO_OWNER}/${IMAGE_NAME}:latest .
docker push ${REGISTRY}/${REPO_OWNER}/${IMAGE_NAME}:${VERSION}
docker push ${REGISTRY}/${REPO_OWNER}/${IMAGE_NAME}:latest