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
4 changes: 2 additions & 2 deletions codemagic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ definitions:
if [ -z "${CM_TAG:-}" ]; then echo "Started by hand on $(git rev-parse --short HEAD)"; exit 0; fi
# A shallow clone cannot prove ancestry.
[ "$(git rev-parse --is-shallow-repository)" = false ] || git fetch --quiet --unshallow origin
git fetch --quiet origin main
git fetch --quiet origin +refs/heads/main:refs/remotes/origin/main
git merge-base --is-ancestor HEAD origin/main \
|| { echo "Tag $CM_TAG is not on main"; exit 1; }
- &require_version_tag
Expand Down Expand Up @@ -308,7 +308,7 @@ workflows:
- name: Require the tag to be the tip of main
script: |
set -euo pipefail
git fetch --quiet origin main
git fetch --quiet origin +refs/heads/main:refs/remotes/origin/main
[ "$(git rev-parse HEAD)" = "$(git rev-parse origin/main)" ] \
|| { echo "OTA must publish the current main; ${CM_TAG:-this commit} is not its tip"; exit 1; }
# ota-release.zsh insists on the main branch; a tag build is detached.
Expand Down
4 changes: 3 additions & 1 deletion scripts/ota-release.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ if [[ -n "$(git status --porcelain)" ]]; then
exit 1
fi

git fetch --quiet origin main
# An explicit refspec: a CI clone of a tag may have no remote-tracking branches,
# and a bare `fetch origin main` then updates only FETCH_HEAD.
git fetch --quiet origin +refs/heads/main:refs/remotes/origin/main
local_head="$(git rev-parse HEAD)"
remote_head="$(git rev-parse origin/main)"
if [[ "$local_head" != "$remote_head" ]]; then
Expand Down
4 changes: 3 additions & 1 deletion test/release/otaRelease.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ describe('production OTA release contract', () => {
it('requires a clean checkout at the exact latest main commit', () => {
expect(script).toContain('git branch --show-current');
expect(script).toContain('git status --porcelain');
expect(script).toContain('git fetch --quiet origin main');
expect(script).toContain(
'git fetch --quiet origin +refs/heads/main:refs/remotes/origin/main',
);
expect(script).toContain('git rev-parse origin/main');
expect(script).toContain('if [[ "$local_head" != "$remote_head" ]]');
expect(script).toContain('gh run list');
Expand Down
Loading