From 6dfc98b9826f8d39b72d14c10c541ff7a80e9bd3 Mon Sep 17 00:00:00 2001 From: B3ni Date: Sun, 22 Jun 2025 02:57:30 +0200 Subject: [PATCH] Enhance build-and-release workflow to handle merge conflicts and improve version update logic --- .gitea/workflows/build-and-release.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/build-and-release.yml b/.gitea/workflows/build-and-release.yml index da0142f..1efd006 100644 --- a/.gitea/workflows/build-and-release.yml +++ b/.gitea/workflows/build-and-release.yml @@ -11,6 +11,10 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 10 + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + steps: - name: Checkout code uses: actions/checkout@v3 @@ -60,9 +64,18 @@ jobs: - name: Commit version update run: | - git pull origin main + # Pull changes and handle potential merge conflicts + git pull origin main || true + + # If conflict occurs, keep both version entries + if git diff --name-only --diff-filter=U | grep -q "versions.txt"; then + git checkout --ours versions.txt + echo "New version: ${{ env.VERSION }}" >> versions.txt + git add versions.txt + fi + git add versions.txt - git commit -m "Update to version ${{ env.VERSION }} [skip ci]" + git commit -m "Update to version ${{ env.VERSION }} [skip ci]" || echo "No changes to commit" git push origin main - name: Create Release