diff --git a/creators/extension/app/files/.github/workflows/build-extension-charts.yml b/creators/extension/app/files/.github/workflows/build-extension-charts.yml index 73343d8f948..eadced784b0 100644 --- a/creators/extension/app/files/.github/workflows/build-extension-charts.yml +++ b/creators/extension/app/files/.github/workflows/build-extension-charts.yml @@ -2,7 +2,7 @@ name: Build and Release Extension Charts on: workflow_dispatch: - release: + release: types: [released] defaults: @@ -12,7 +12,7 @@ defaults: jobs: build-extension-charts: - uses: rancher/dashboard/.github/workflows/build-extension-charts.yml@master + uses: rancher/dashboard/.github/workflows/build-extension-charts.yml@release-2.9 permissions: actions: write contents: write @@ -20,3 +20,4 @@ jobs: pages: write with: target_branch: gh-pages + tagged_release: ${{ github.ref_name }} diff --git a/creators/extension/package.json b/creators/extension/package.json index ce14fe766e4..71ac57da5d1 100644 --- a/creators/extension/package.json +++ b/creators/extension/package.json @@ -1,7 +1,7 @@ { "name": "@rancher/create-extension", "description": "Rancher UI Extension generator", - "version": "0.2.1-rc.1", + "version": "2.0.0", "license": "Apache-2.0", "author": "SUSE", "packageManager": "yarn@4.4.1", diff --git a/creators/extension/pkg/init b/creators/extension/pkg/init index c4484551cc4..91e3f88c630 100755 --- a/creators/extension/pkg/init +++ b/creators/extension/pkg/init @@ -105,68 +105,6 @@ Object.keys(targets).forEach((target) => { } }); -// Add annotation for the latest Rancher version by default -function fetchLatestVersion() { - console.log(' Fetching latest Rancher Version'); - const options = { headers: { 'User-Agent': 'nodejs' } }; - - https.get('https://api.github.com/repos/rancher/rancher/releases/latest', options, (res) => { - const { statusCode } = res; - const contentType = res.headers['content-type']; - - let error; - - if ( statusCode !== 200 ) { - error = new Error(' Request Failed.\n' + - ` Status Code: ${ statusCode }`); - } else if ( !/^application\/json/.test(contentType) ) { - error = new Error(' Invalid content-type.\n' + - ` Expected application/json but received ${ contentType }`); - } - - if ( error ) { - console.log(error.message); - - res.resume(); - - return; - } - - res.setEncoding('utf8'); - let rawData = ''; - - res.on('data', (chunk) => { - rawData += chunk; - }); - res.on('end', () => { - try { - const release = JSON.parse(rawData); - - if ( release.tag_name ) { - console.log(` Adding rancher-version annotation '>= ${ release.tag_name }' to package.json`); - - pkg.rancher = { annotations: { 'catalog.cattle.io/rancher-version': `>= ${ release.tag_name }` } }; - - if ( !shellVersion ) { - console.log('Could not get a shell version from npm, skipping adding catalog.cattle.io/ui-extensions-version annotation to package.json'); - } else { - console.log(` Adding catalog.cattle.io/ui-extensions-version '>= ${ shellVersion }' to package.json`); - - pkg.rancher.annotations['catalog.cattle.io/ui-extensions-version'] = `>= ${ shellVersion }`; - } - - writePackageJson(); - } - } catch (e) { - console.log(' Error parsing release data', e); - } - }); - }).on('error', (e) => { - console.log(' Error fetching latest Rancher Version', e); - }); -} - -fetchLatestVersion(); writePackageJson(); // Add dependencies diff --git a/creators/extension/pkg/package.json b/creators/extension/pkg/package.json index 0566ff56fd5..11182b86428 100644 --- a/creators/extension/pkg/package.json +++ b/creators/extension/pkg/package.json @@ -10,6 +10,12 @@ "**/*.*", "init" ], + "rancher": { + "annotations": { + "catalog.cattle.io/rancher-version": ">= 2.9.0 < 2.10.0", + "catalog.cattle.io/ui-extensions-version": "< 3.0.0" + } + }, "engines": { "node": ">=16.0.0" },