Skip to content

Commit 739bbd9

Browse files
committed
Exclude .gitignore from UPM branches and route pre-releases to upm-preview
- Add .gitignore and .gitignore.meta to the list of files stripped from the UPM tree so consumers don't inherit repo-level ignore rules. - Route pre-release versions (e.g. 1.2.0-rc.1) to the upm-preview branch instead of upm, keeping the stable branch clean. https://claude.ai/code/session_018ztFp8Pk5fVJ7Vcm94eTEs
1 parent a741b41 commit 739bbd9

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ jobs:
128128
set -euo pipefail
129129
VERSION="${{ steps.version.outputs.version }}"
130130
TAG="${{ steps.version.outputs.tag }}"
131+
PRERELEASE="${{ steps.version.outputs.prerelease }}"
131132
UPM_TAG="upm/$VERSION"
132133
133134
if git ls-remote --exit-code --tags origin "$UPM_TAG" >/dev/null 2>&1; then
@@ -141,20 +142,26 @@ jobs:
141142
trap 'rm -f "$UPM_INDEX"' EXIT
142143
export GIT_INDEX_FILE="$UPM_INDEX"
143144
git read-tree "$TAG"
144-
git rm -r --cached --quiet --ignore-unmatch .github CLAUDE.md CLAUDE.md.meta
145+
git rm -r --cached --quiet --ignore-unmatch .github CLAUDE.md CLAUDE.md.meta .gitignore .gitignore.meta
145146
TREE=$(git write-tree)
146147
unset GIT_INDEX_FILE
147148
PARENT=$(git rev-parse "$TAG^{commit}")
148149
COMMIT=$(git commit-tree "$TREE" -p "$PARENT" -m "UPM release $VERSION")
149150
150-
# Move the upm branch forward to this release's commit.
151-
git push --force origin "$COMMIT:refs/heads/upm"
151+
# Move the appropriate upm branch forward:
152+
# pre-releases → upm-preview, stable releases → upm.
153+
if [[ "$PRERELEASE" == "true" ]]; then
154+
UPM_BRANCH="upm-preview"
155+
else
156+
UPM_BRANCH="upm"
157+
fi
158+
git push --force origin "$COMMIT:refs/heads/$UPM_BRANCH"
152159
153160
# Immutable per-version tag for users who pin to a specific release.
154161
git tag "$UPM_TAG" "$COMMIT"
155162
git push origin "$UPM_TAG"
156163
157-
echo "Published $UPM_TAG and updated upm branch."
164+
echo "Published $UPM_TAG and updated $UPM_BRANCH branch."
158165
159166
- name: Create GitHub release
160167
uses: softprops/action-gh-release@v2

0 commit comments

Comments
 (0)