pxt-core 13.1.1 → 13.1.3

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/built/cli.js CHANGED
@@ -841,6 +841,9 @@ function gitUploadAsync(opts, uplReqs) {
841
841
  });
842
842
  }
843
843
  async function uploadToGitRepoAsync(opts, uplReqs) {
844
+ if (process.env["PXT_SKIP_GIT_COMMIT"]) {
845
+ return writeFilesToPushAsync(opts, uplReqs);
846
+ }
844
847
  let label = opts.label;
845
848
  if (!label) {
846
849
  console.log('no label; skip release upload');
@@ -941,6 +944,40 @@ async function uploadToGitRepoAsync(opts, uplReqs) {
941
944
  }
942
945
  });
943
946
  }
947
+ async function writeFilesToPushAsync(opts, uplReqs) {
948
+ let label = opts.label;
949
+ if (!label) {
950
+ console.log('no label; skip release upload');
951
+ return Promise.resolve();
952
+ }
953
+ let tid = pxt.appTarget.id;
954
+ if (U.startsWith(label, tid + "/"))
955
+ label = label.slice(tid.length + 1);
956
+ if (!/^v\d/.test(label)) {
957
+ console.log(`label "${label}" is not a version; skipping release upload`);
958
+ return Promise.resolve();
959
+ }
960
+ const releasesDir = path.resolve("tmp/releases");
961
+ const outDir = path.join(releasesDir, "built");
962
+ console.log("writing release files to " + releasesDir);
963
+ nodeutil.mkdirP(outDir);
964
+ const info = await ciBuildInfoAsync();
965
+ const releaseInfo = {
966
+ url: info.commitUrl,
967
+ tag: label
968
+ };
969
+ // this gets read by the github actions workflow
970
+ fs.writeFileSync(path.join(releasesDir, "release.json"), JSON.stringify(releaseInfo, null, 2), { encoding: "utf8" });
971
+ // copy the files into the built directory. the actual push to the git repo will be
972
+ // handled by the github actions workflow
973
+ for (let u of U.values(uplReqs)) {
974
+ let fpath = path.join(outDir, u.filename);
975
+ nodeutil.mkdirP(path.dirname(fpath));
976
+ fs.writeFileSync(fpath, u.content, { encoding: u.encoding });
977
+ }
978
+ // make sure there's always something to commit
979
+ fs.writeFileSync(path.join(outDir, "stamp.txt"), new Date().toString());
980
+ }
944
981
  function uploadedArtFileCdnUrl(fn) {
945
982
  if (!fn || /^(https?|data):/.test(fn))
946
983
  return fn; // nothing to do
package/built/pxt.js CHANGED
@@ -165002,6 +165002,9 @@ function gitUploadAsync(opts, uplReqs) {
165002
165002
  });
165003
165003
  }
165004
165004
  async function uploadToGitRepoAsync(opts, uplReqs) {
165005
+ if (process.env["PXT_SKIP_GIT_COMMIT"]) {
165006
+ return writeFilesToPushAsync(opts, uplReqs);
165007
+ }
165005
165008
  let label = opts.label;
165006
165009
  if (!label) {
165007
165010
  console.log('no label; skip release upload');
@@ -165102,6 +165105,40 @@ async function uploadToGitRepoAsync(opts, uplReqs) {
165102
165105
  }
165103
165106
  });
165104
165107
  }
165108
+ async function writeFilesToPushAsync(opts, uplReqs) {
165109
+ let label = opts.label;
165110
+ if (!label) {
165111
+ console.log('no label; skip release upload');
165112
+ return Promise.resolve();
165113
+ }
165114
+ let tid = pxt.appTarget.id;
165115
+ if (U.startsWith(label, tid + "/"))
165116
+ label = label.slice(tid.length + 1);
165117
+ if (!/^v\d/.test(label)) {
165118
+ console.log(`label "${label}" is not a version; skipping release upload`);
165119
+ return Promise.resolve();
165120
+ }
165121
+ const releasesDir = path.resolve("tmp/releases");
165122
+ const outDir = path.join(releasesDir, "built");
165123
+ console.log("writing release files to " + releasesDir);
165124
+ nodeutil.mkdirP(outDir);
165125
+ const info = await ciBuildInfoAsync();
165126
+ const releaseInfo = {
165127
+ url: info.commitUrl,
165128
+ tag: label
165129
+ };
165130
+ // this gets read by the github actions workflow
165131
+ fs.writeFileSync(path.join(releasesDir, "release.json"), JSON.stringify(releaseInfo, null, 2), { encoding: "utf8" });
165132
+ // copy the files into the built directory. the actual push to the git repo will be
165133
+ // handled by the github actions workflow
165134
+ for (let u of U.values(uplReqs)) {
165135
+ let fpath = path.join(outDir, u.filename);
165136
+ nodeutil.mkdirP(path.dirname(fpath));
165137
+ fs.writeFileSync(fpath, u.content, { encoding: u.encoding });
165138
+ }
165139
+ // make sure there's always something to commit
165140
+ fs.writeFileSync(path.join(outDir, "stamp.txt"), new Date().toString());
165141
+ }
165105
165142
  function uploadedArtFileCdnUrl(fn) {
165106
165143
  if (!fn || /^(https?|data):/.test(fn))
165107
165144
  return fn; // nothing to do