Skip to content

Commit 48f320d

Browse files
publish: record the https clone URL in the StepLib, not the SSH one
`bitrise share create --git <url>` writes its argument into the published step.yml as `source.git`, and that is the URL every user's Bitrise CLI clones the Step from, anonymously. publish.sh passed the same git@github.com: URL it uses to push, so the first release would have shipped a Step nobody outside the org could run -- and a published version is immutable, so the only remedy would have been to publish another one. Pushing still uses SSH; only the recorded URL changes. Every entry in the StepLib is https, including this Step's own 0.0.1, which is what the dry run was checked against.
1 parent 8cfa1d8 commit 48f320d

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

‎scripts/publish.sh‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ esac
6565

6666
STEP_REPO="$(repo_for_step "$STEP_ID")" || die "no publish repository registered for '${STEP_ID}'"
6767

68+
# Pushing needs SSH; the StepLib entry must not. `bitrise share create --git`
69+
# writes its argument into the published step.yml as `source.git`, and that is
70+
# the URL every user's Bitrise CLI clones the Step from -- anonymously. Ship
71+
# git@github.com: there and nobody outside the org can run the Step, and the
72+
# version is immutable, so the only fix would be to publish another one. Every
73+
# entry in the StepLib is https, including this Step's own 0.0.1.
74+
STEP_REPO_HTTPS="$(printf '%s' "$STEP_REPO" | sed -e 's#^git@github\.com:#https://github.com/#')"
75+
6876
# --- preflight ---------------------------------------------------------------
6977

7078
echo "==> Preflight"
@@ -90,6 +98,7 @@ STEP_BRANCH="$(remote_default_branch "$STEP_REPO")"
9098
echo " step: ${STEP_ID}"
9199
echo " version: ${VERSION}"
92100
echo " mirror: ${STEP_REPO} (${STEP_BRANCH})"
101+
echo " steplib source.git: ${STEP_REPO_HTTPS}"
93102
echo " steplib: ${STEPLIB_FORK}"
94103

95104
# --- mirror ------------------------------------------------------------------
@@ -105,7 +114,7 @@ Dry run -- nothing was pushed. Re-run with --push to perform:
105114
Then share to the StepLib:
106115
107116
bitrise share start -c ${STEPLIB_FORK}
108-
bitrise share create --stepid ${STEP_ID} --tag ${VERSION} --git ${STEP_REPO}
117+
bitrise share create --stepid ${STEP_ID} --tag ${VERSION} --git ${STEP_REPO_HTTPS}
109118
bitrise share audit -c ${STEPLIB_FORK}
110119
bitrise share finish
111120
@@ -140,7 +149,7 @@ cat <<EOF
140149
Now share it to the StepLib:
141150
142151
bitrise share start -c ${STEPLIB_FORK}
143-
bitrise share create --stepid ${STEP_ID} --tag ${VERSION} --git ${STEP_REPO}
152+
bitrise share create --stepid ${STEP_ID} --tag ${VERSION} --git ${STEP_REPO_HTTPS}
144153
bitrise share audit -c ${STEPLIB_FORK}
145154
bitrise share finish
146155

0 commit comments

Comments
 (0)