mlflow/.gitea/workflows/release.yaml

64 lines
2.3 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:
branches:
- main
jobs:
2024-01-31 12:38:37 +00:00
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 latest git tag
id: tag
run: echo "tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
- name: Get mlflow version
id: mlflow
run: echo "mlflow=$(cat requirements.txt | grep mlflow | cut -d'=' -f3)" >> $GITHUB_OUTPUT
- name: Create tag if it doesn't exist
id: create
run: |
if git tag -l "${{ steps.tag.outputs.tag }}"; then
echo "Tag already exists"
echo "created=false" >> $GITHUB_OUTPUT
else
2024-01-31 13:00:34 +00:00
git tag ${{ steps.mlflow.outputs.mlflow }} -m "Tag ${{ steps.mlflow.outputs.mlflow }}"
2024-01-31 12:38:37 +00:00
git push origin ${{ steps.mlflow.outputs.mlflow }}
echo "created=true" >> $GITHUB_OUTPUT
fi
2023-11-29 21:24:47 +00:00
build:
2024-01-31 10:58:17 +00:00
name: Build and push mlflow container
2024-01-31 12:38:37 +00:00
needs: tag
if: ${{ needs.tag.outputs.tag_created == 'true' }}
2023-11-29 21:24:47 +00:00
runs-on: ubuntu-latest
container: ghcr.io/catthehacker/ubuntu:act-latest@sha256:07466dbbecd8690579d9bcbf8a1214240b91534cf03eed5f222e7fd80131f582
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
- name: Login to Registry
uses: docker/login-action@v3
with:
registry: git.namesny.com
username: ${{ gitea.actor }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build and push
run: |
VERSION=$(cat requirements.txt | grep mlflow | cut -d'=' -f3)
2024-01-05 10:55:25 +00:00
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}
2023-11-29 21:24:47 +00:00
docker push ${REGISTRY}/${REPO_OWNER}/${IMAGE_NAME}:latest