2024-01-31 10:58:17 +00:00
|
|
|
name: Build and push mlflow container
|
2023-11-29 21:24:47 +00:00
|
|
|
on:
|
|
|
|
push:
|
2024-01-31 15:42:29 +00:00
|
|
|
branches:
|
|
|
|
- main
|
2023-11-29 21:24:47 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
2024-01-31 10:58:17 +00:00
|
|
|
name: Build and push mlflow container
|
2023-11-29 21:24:47 +00:00
|
|
|
runs-on: ubuntu-latest
|
2024-02-09 01:00:48 +00:00
|
|
|
container: ghcr.io/catthehacker/ubuntu:act-latest@sha256:3115d340e5fc9e7b4d1cf5cc72e9f475d1bf6419bda158883e3bff9a36674a0e
|
2023-11-29 21:24:47 +00:00
|
|
|
env:
|
|
|
|
IMAGE_NAME: mlflow
|
|
|
|
REGISTRY: git.namesny.com
|
|
|
|
REPO_OWNER: cluster
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
2024-01-31 15:42:29 +00:00
|
|
|
- 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
|
2023-11-29 21:24:47 +00:00
|
|
|
- name: Login to Registry
|
|
|
|
uses: docker/login-action@v3
|
2024-01-31 15:42:29 +00:00
|
|
|
if: steps.create.outputs.tag_exists == 'false'
|
2023-11-29 21:24:47 +00:00
|
|
|
with:
|
|
|
|
registry: git.namesny.com
|
|
|
|
username: ${{ gitea.actor }}
|
|
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- name: Build and push
|
2024-01-31 15:42:29 +00:00
|
|
|
if: steps.create.outputs.tag_exists == 'false'
|
2023-11-29 21:24:47 +00:00
|
|
|
run: |
|
|
|
|
VERSION=$(cat requirements.txt | grep mlflow | cut -d'=' -f3)
|
2024-02-01 12:33:36 +00:00
|
|
|
docker build -t ${REGISTRY}/${REPO_OWNER}/${IMAGE_NAME}:${VERSION} -t ${REGISTRY}/${REPO_OWNER}/${IMAGE_NAME}:latest .
|
|
|
|
docker push ${REGISTRY}/${REPO_OWNER}/${IMAGE_NAME}:${VERSION}
|
2024-01-31 15:27:52 +00:00
|
|
|
docker push ${REGISTRY}/${REPO_OWNER}/${IMAGE_NAME}:latest
|