Remove unused package publish-release

Change-type: patch
This commit is contained in:
myarmolinsky 2024-07-05 08:00:18 -04:00
parent 5b1d6a3190
commit 93e597a596
5 changed files with 62 additions and 1179 deletions

View File

@ -15,49 +15,11 @@
* limitations under the License. * limitations under the License.
*/ */
import * as Bluebird from 'bluebird';
import * as _ from 'lodash'; import * as _ from 'lodash';
import * as semver from 'semver'; import * as semver from 'semver';
import { finalReleaseAssets, version } from './build-bin';
const { GITHUB_TOKEN } = process.env; const { GITHUB_TOKEN } = process.env;
/**
* Create or update a release in GitHub's releases page, uploading the
* installer files (standalone zip + native oclif installers).
*/
export async function createGitHubRelease() {
console.log(`Publishing release ${version} to GitHub`);
const publishRelease = await import('publish-release');
const ghRelease = (await Bluebird.fromCallback(
publishRelease.bind(null, {
token: GITHUB_TOKEN || '',
owner: 'balena-io',
repo: 'balena-cli',
tag: version,
name: `balena-CLI ${version}`,
reuseRelease: true,
assets: finalReleaseAssets[process.platform],
}),
)) as { html_url: any };
console.log(`Release ${version} successful: ${ghRelease.html_url}`);
}
/**
* Top-level function to create a CLI release in GitHub's releases page:
* call zipStandaloneInstaller(), rename the files as we'd like them to
* display on the releases page, and call createGitHubRelease() to upload
* the files.
*/
export async function release() {
try {
await createGitHubRelease();
} catch (err) {
throw new Error(`Error creating GitHub release:\n${err}`);
}
}
/** Return a cached Octokit instance, creating a new one as needed. */ /** Return a cached Octokit instance, creating a new one as needed. */
const getOctokit = _.once(function () { const getOctokit = _.once(function () {
const Octokit = ( const Octokit = (

View File

@ -24,10 +24,7 @@ import {
signFilesForNotarization, signFilesForNotarization,
testShrinkwrap, testShrinkwrap,
} from './build-bin'; } from './build-bin';
import { import { updateDescriptionOfReleasesAffectedByIssue1359 } from './deploy-bin';
release,
updateDescriptionOfReleasesAffectedByIssue1359,
} from './deploy-bin';
// DEBUG set to falsy for negative values else is truthy // DEBUG set to falsy for negative values else is truthy
process.env.DEBUG = ['0', 'no', 'false', '', undefined].includes( process.env.DEBUG = ['0', 'no', 'false', '', undefined].includes(
@ -41,7 +38,6 @@ process.env.DEBUG = ['0', 'no', 'false', '', undefined].includes(
* of the following strings, then call the appropriate functions: * of the following strings, then call the appropriate functions:
* 'build:installer' (to build a native oclif installer) * 'build:installer' (to build a native oclif installer)
* 'build:standalone' (to build a standalone pkg package) * 'build:standalone' (to build a standalone pkg package)
* 'release' (to create/update a GitHub release)
* *
* @param args Arguments to parse (default is process.argv.slice(2)) * @param args Arguments to parse (default is process.argv.slice(2))
*/ */
@ -59,7 +55,6 @@ async function parse(args?: string[]) {
'catch-uncommitted': catchUncommitted, 'catch-uncommitted': catchUncommitted,
'test-shrinkwrap': testShrinkwrap, 'test-shrinkwrap': testShrinkwrap,
fix1359: updateDescriptionOfReleasesAffectedByIssue1359, fix1359: updateDescriptionOfReleasesAffectedByIssue1359,
release,
}; };
for (const arg of args) { for (const arg of args) {
if (!Object.hasOwn(commands, arg)) { if (!Object.hasOwn(commands, arg)) {

1155
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

View File

@ -60,7 +60,6 @@
"build:standalone": "ts-node --transpile-only automation/run.ts build:standalone", "build:standalone": "ts-node --transpile-only automation/run.ts build:standalone",
"build:installer": "ts-node --transpile-only automation/run.ts build:installer", "build:installer": "ts-node --transpile-only automation/run.ts build:installer",
"package": "npm run build:fast && npm run build:standalone && npm run build:installer", "package": "npm run build:fast && npm run build:standalone && npm run build:installer",
"release": "ts-node --transpile-only automation/run.ts release",
"pretest": "npm run build", "pretest": "npm run build",
"test": "npm run test:shrinkwrap && npm run test:core", "test": "npm run test:shrinkwrap && npm run test:core",
"test:core": "npm run test:source && npm run test:standalone", "test:core": "npm run test:source && npm run test:standalone",
@ -190,7 +189,6 @@
"nock": "^13.2.1", "nock": "^13.2.1",
"oclif": "^3.17.1", "oclif": "^3.17.1",
"parse-link-header": "^2.0.0", "parse-link-header": "^2.0.0",
"publish-release": "^1.6.1",
"rewire": "^5.0.0", "rewire": "^5.0.0",
"simple-git": "^3.14.1", "simple-git": "^3.14.1",
"sinon": "^11.1.2", "sinon": "^11.1.2",

View File

@ -1,39 +0,0 @@
/**
* @license
* Copyright 2019 Balena Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare module 'publish-release' {
interface PublishOptions {
token: string;
owner: string;
repo: string;
tag: string;
name: string;
reuseRelease?: boolean;
assets: string[];
}
interface Release {
html_url: string;
}
let publishRelease: (
args: PublishOptions,
callback: (e: Error, release: Release) => void,
) => void;
export = publishRelease;
}