From e2477ccb21210838a1b9f96d3e5e63c6b2a58d26 Mon Sep 17 00:00:00 2001 From: Shashank Agarwal Date: Wed, 13 Nov 2024 13:50:33 +0530 Subject: [PATCH] Fix Git build --- .github/workflows/docker-build.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index c24283d..808a5b8 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -3,9 +3,9 @@ name: Docker Build and Push on: push: branches: - - '**' # Match all branches + - 'main' # Only trigger push events on main tags: [ "v*" ] - pull_request: + pull_request: # Keep PR triggers for all branches workflow_dispatch: env: @@ -14,6 +14,8 @@ env: jobs: docker: + # Skip this job if it's a push event on a non-main branch + if: github.event_name != 'push' || github.ref == 'refs/heads/main' runs-on: ubuntu-latest permissions: contents: read @@ -23,6 +25,13 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + # Generate Cargo.lock if it doesn't exist + - name: Generate Cargo.lock + run: | + if [ ! -f "Cargo.lock" ]; then + cargo generate-lockfile + fi + - name: Extract version from Cargo.toml id: version run: |