From 8f40626f2f078cb6fc9f891747fce500bdbae49b Mon Sep 17 00:00:00 2001 From: Frederic Cabassut Date: Sat, 7 Mar 2026 08:04:11 +0100 Subject: [PATCH] fix: update docker-compose only after Docker image is pushed Move docker-compose.yml update from release.sh (pre-build) to a post-release job in both bump.yml and release.yml. This ensures the image tag in docker-compose only appears on main after the image exists on ghcr.io, preventing Dokploy from trying to pull a non-existent image. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/bump.yml | 25 +++++++++++++++++++++++++ .github/workflows/release.yml | 25 +++++++++++++++++++++++++ scripts/release.sh | 3 +-- 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bump.yml b/.github/workflows/bump.yml index 242a27d..a6c4d5d 100644 --- a/.github/workflows/bump.yml +++ b/.github/workflows/bump.yml @@ -95,3 +95,28 @@ jobs: with: tag_name: ${{ needs.bump.outputs.tag }} generate_release_notes: true + + pin-docker-compose: + name: Pin docker-compose to released version + runs-on: ubuntu-latest + needs: [bump, release] + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + with: + ref: main + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Update docker-compose.yml + env: + TAG: ${{ needs.bump.outputs.tag }} + run: | + VERSION="${TAG#v}" + sed -i "s|image: ghcr.io/bretzel-app/crumbs:.*|image: ghcr.io/bretzel-app/crumbs:${VERSION}|" docker-compose.yml + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add docker-compose.yml + git diff --cached --quiet && exit 0 + git commit -m "chore: pin docker-compose to ${TAG} [skip ci]" + git push origin main diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dc0c5ec..0b94658 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -54,3 +54,28 @@ jobs: uses: softprops/action-gh-release@v2 with: generate_release_notes: true + + pin-docker-compose: + name: Pin docker-compose to released version + runs-on: ubuntu-latest + needs: release + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + with: + ref: main + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Update docker-compose.yml + env: + TAG: ${{ github.ref_name }} + run: | + VERSION="${TAG#v}" + sed -i "s|image: ghcr.io/bretzel-app/crumbs:.*|image: ghcr.io/bretzel-app/crumbs:${VERSION}|" docker-compose.yml + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add docker-compose.yml + git diff --cached --quiet && exit 0 + git commit -m "chore: pin docker-compose to ${TAG} [skip ci]" + git push origin main diff --git a/scripts/release.sh b/scripts/release.sh index 711e9cb..dc73cc3 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -60,8 +60,7 @@ echo "Bumping $BUMP version..." npm version "$BUMP" -m "chore: bump version to %s" --no-git-tag-version NEW_VERSION=$(node -p "require('./package.json').version") -sed -i'' -e "s|image: ghcr.io/bretzel-app/crumbs:.*|image: ghcr.io/bretzel-app/crumbs:${NEW_VERSION}|" docker-compose.yml -git add package.json docker-compose.yml +git add package.json git commit -m "chore: bump version to $NEW_VERSION" git tag "v$NEW_VERSION"