mlflow/.gitea/workflows/release.yaml

51 lines
1.8 KiB
YAML
Raw Normal View History

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
container: ghcr.io/catthehacker/ubuntu:act-latest@sha256:f7a21149ff1ee95f66ad0697ddf69a01c4cb580dd50a7ae2560877f1aa0a0f4f
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