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"