easy-vps 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/services/deploy.js +17 -2
- package/package.json +2 -1
package/dist/services/deploy.js
CHANGED
|
@@ -235,15 +235,30 @@ function buildScript(config) {
|
|
|
235
235
|
'set -e',
|
|
236
236
|
`echo "==> Deploying ${config.name} (${config.domain ?? `port ${config.port}`})"`,
|
|
237
237
|
`mkdir -p ${APPS_DIR}`,
|
|
238
|
+
// Embed the stored Github token straight into the clone URL so the fetch
|
|
239
|
+
// authenticates without depending on the credential helper being picked up
|
|
240
|
+
// inside this streaming login shell. Falls back to the plain URL (credential
|
|
241
|
+
// helper still applies) when no token is configured.
|
|
242
|
+
`REPO=${(0, ssh_1.quote)(config.repository)}`,
|
|
243
|
+
step('Resolving Github credentials'),
|
|
244
|
+
'TOKEN=""\n' +
|
|
245
|
+
'if [ -f ~/.git-credentials ]; then\n' +
|
|
246
|
+
' TOKEN=$(grep "github.com" ~/.git-credentials 2>/dev/null | head -n1 | sed -E "s#^https://([^@]+)@github.com#\\1#" | sed -E "s#^[^:]+:##")\n' +
|
|
247
|
+
'fi\n' +
|
|
248
|
+
'if [ -n "$TOKEN" ]; then\n' +
|
|
249
|
+
' AUTH_REPO="https://${TOKEN}@github.com/${REPO#https://github.com/}"\n' +
|
|
250
|
+
'else\n' +
|
|
251
|
+
' AUTH_REPO="$REPO"\n' +
|
|
252
|
+
'fi',
|
|
238
253
|
step(`Fetching ${config.repository} @ ${branch}`),
|
|
239
254
|
// Re-deploying an existing site updates the clone in place instead of failing.
|
|
240
255
|
`if [ -d "$HOME/easy-vps-apps/${config.name}/.git" ]; then
|
|
241
256
|
cd ${dir}
|
|
242
|
-
git remote set-url origin $
|
|
257
|
+
git remote set-url origin "$AUTH_REPO"
|
|
243
258
|
git fetch --depth 1 origin ${(0, ssh_1.quote)(branch)}
|
|
244
259
|
git checkout -B ${(0, ssh_1.quote)(branch)} FETCH_HEAD
|
|
245
260
|
else
|
|
246
|
-
git clone --depth 1 --branch ${(0, ssh_1.quote)(branch)} $
|
|
261
|
+
git clone --depth 1 --branch ${(0, ssh_1.quote)(branch)} "$AUTH_REPO" ${dir}
|
|
247
262
|
cd ${dir}
|
|
248
263
|
fi`,
|
|
249
264
|
'git --no-pager log -1 --pretty="cloned %h %s"',
|
package/package.json
CHANGED