diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index 393eacd..6cc9e5e 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -1,8 +1,8 @@ name: Build and push mlflow container on: push: - tags: - - '[0-9]+.[0-9]+.[0-9]+' + branches: + - main jobs: build: @@ -16,13 +16,34 @@ jobs: 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) TODAY=$(date +'%Y-%m-%d') diff --git a/.gitea/workflows/tag.yaml b/.gitea/workflows/tag.yaml deleted file mode 100644 index 00d3465..0000000 --- a/.gitea/workflows/tag.yaml +++ /dev/null @@ -1,31 +0,0 @@ -name: Tag mlflow release -on: - push: - branches: - - main - -jobs: - tag: - name: Create mlflow tag - runs-on: ubuntu-latest - 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 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" - else - git tag ${{ steps.mlflow.outputs.mlflow }} - git push origin ${{ steps.mlflow.outputs.mlflow }} - fi