-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: build & publish dynamic plugins
- Loading branch information
1 parent
d9ff4ca
commit 637b937
Showing
7 changed files
with
62 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,4 @@ jobs: | |
- run: yarn tsc | ||
- run: yarn test:all | ||
- run: yarn build:all | ||
- run: ./scripts/build-dynamic-plugins.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 0 additions & 21 deletions
21
plugins/humanitec/dynamic-export/export-dynamic-plugins.sh
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
currentDir=$(cd "$(dirname "$0")" && pwd) | ||
pluginDir=$currentDir/../plugins | ||
mkdir -p "$currentDir/output" | ||
|
||
# More details on dynamic-plugins can be found here: | ||
# https://github.com/janus-idp/backstage-showcase/blob/main/showcase-docs/dynamic-plugins.md | ||
|
||
echo =================================== | ||
echo Exporting frontend plugin | ||
echo =================================== | ||
cd "$pluginDir/humanitec" | ||
npx --yes @janus-idp/[email protected] package export-dynamic-plugin --embed-as-dependencies --clean --no-in-place | ||
npm pack ./dist-dynamic --pack-destination "$currentDir/output" | ||
echo =================================== | ||
echo Exporting backend plugin | ||
echo =================================== | ||
cd "$pluginDir/humanitec-backend" | ||
npx --yes @janus-idp/[email protected] package export-dynamic-plugin --embed-as-dependencies --clean | ||
npm pack ./dist-dynamic --pack-destination "$currentDir/output" | ||
echo =================================== | ||
echo Exporting backend scaffolder module | ||
echo =================================== | ||
cd "$pluginDir/humanitec-backend-scaffolder-module" | ||
npx --yes @janus-idp/[email protected] package export-dynamic-plugin --embed-as-dependencies --clean | ||
npm pack ./dist-dynamic --pack-destination "$currentDir/output" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env node | ||
|
||
const { execSync } = require('child_process'); | ||
const { join: pathJoin } = require('path'); | ||
|
||
const publishedPackagesJSON = process.argv[2]; | ||
|
||
// The format is [{"name": "@xx/xx", "version": "1.2.0"}, {"name": "@xx/xy", "version": "0.8.9"}] | ||
// https://github.com/changesets/action/tree/v1/?tab=readme-ov-file#outputs | ||
|
||
if (!publishedPackagesJSON) { | ||
console.error('Please provide the list of published packages'); | ||
process.exit(1); | ||
} | ||
|
||
const publishedPackages = JSON.parse(publishedPackagesJSON); | ||
|
||
for (const package of publishedPackages) { | ||
package.name += '-dynamic' | ||
console.log(`Publishing package: ${package.name}@${package.version}`); | ||
|
||
const archive = pathJoin(__dirname, 'output', `${package.name}-${package.version}.tgz`); | ||
|
||
execSync(`npm publish ${archive} --access public`, { stdio: 'inherit' }); | ||
} |