Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/workflows/release-gitflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ jobs:
git config --global user.name "RiotRobot"
- name: Merge to develop
run: |
git checkout develop
git merge -X ours master
pnpm install --lockfile-only --fix-lockfile --frozen-lockfile=false --ignore-scripts
run: .action-repo/scripts/release/merge-master-to-develop.sh

- name: Reset dependencies
if: inputs.dependencies
Expand Down
37 changes: 37 additions & 0 deletions scripts/release/merge-master-develop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

set -ex

git checkout develop
git merge origin/master --no-commit --no-ff || true

CONFLICTS=$(git diff --name-only --diff-filter=U)

if [ -n "$CONFLICTS" ]; then

Check failure on line 10 in scripts/release/merge-master-develop.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use '[[' instead of '[' for conditional tests. The '[[' construct is safer and more feature-rich.

See more on https://sonarcloud.io/project/issues?id=matrix-js-sdk&issues=AZ885KLkUM7ijqRxgH6b&open=AZ885KLkUM7ijqRxgH6b&pullRequest=5403
if echo "$CONFLICTS" | grep -q 'package.json'; then
# Merge package.json in a way where we prefer all changes from `develop`
# except for the `version` field which we take from `master`.
git show HEAD:package.json > package.ours.json # develop
git show FETCH_HEAD:package.json > package.theirs.json # master

jq -s '(.[0].version) as $masterVersion | (reduce .[] as $item ({}; . * $item)) | .version = $masterVersion' package.theirs.json package.ours.json > package.json
rm package.ours.json package.theirs.json
git add package.json
fi

# Reset lockfile to ours (develop) to clear raw text syntax errors
if echo "$CONFLICTS" | grep -q 'pnpm-lock.yaml'; then
git checkout --ours pnpm-lock.yaml
fi

# Fallback for any other files
git checkout --ours . 2>/dev/null || true
fi

# Rebuild lockfile based on the unified package.json
pnpm install --lockfile-only --ignore-scripts --frozen-lockfile=false

# Commit and push
git add .
git commit --no-edit
git push origin develop
Loading