mlflow/.gitea/workflows/release.yaml

51 lines
1.9 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: git.namesny.com/cluster/act-runner:v1@sha256:12ecb5835cd38f38bf9fc7589abc3751861bd737c612bb2a6194615810cb4f92
2023-11-29 21:24:47 +00:00
env:
IMAGE_NAME: mlflow
2024-02-13 10:35:53 +00:00
REGISTRY: git.namesny.com
2023-11-29 21:24:47 +00:00
REPO_OWNER: cluster
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # 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@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # 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