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