Update build workflow and remove unused script

This commit is contained in:
Simon Larsen 2024-03-14 13:56:39 +00:00
parent 9a25f8ea00
commit 6a9a7bfd32
No known key found for this signature in database
GPG Key ID: AB45983AA9C81CDE
3 changed files with 49 additions and 37 deletions

View File

@ -48,12 +48,8 @@ jobs:
uses: actions/checkout@v2
- name: Preinstall
run: npm run prerun
- run: cd Common && npm install
- run: cd Model && npm install
- run: cd CommonServer && npm install
- run: cd CommonUI && npm install --force
- name: Publish Infrastructure Agent
run: cd InfrastructureAgent && npm run publish-package
run: bash ./Scripts/NPM/PublishAllPackages.sh
docker-build-accounts:
runs-on: ubuntu-latest

View File

@ -1,32 +0,0 @@
# Set the package name and version
package_version=$PACKAGE_VERSION
# If no package version is provided, exit
if [ -z "$package_version" ]; then
echo "Package version is required"
exit 1
fi
# touch npmrc file
touch ~/.npmrc
# Add Auth Token to npmrc file
echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" > ~/.npmrc
echo "//registry.npmjs.org/:email=npm@oneuptime.com" >> ~/.npmrc
npm version $package_version
# Run npm install
npm install
# Run npm compile
npm run compile
# Publish the package
npm publish --tag latest
# Tag the package with the specified version
npm dist-tag add $package_name@$package_version latest
# Logout from npm
npm logout

View File

@ -0,0 +1,48 @@
#!/bin/bash
# Set the package name and version
package_version=$PACKAGE_VERSION
# If no package version is provided, exit
if [ -z "$package_version" ]; then
echo "Package version is required"
exit 1
fi
# touch npmrc file
touch ~/.npmrc
# Add Auth Token to npmrc file
echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" > ~/.npmrc
echo "//registry.npmjs.org/:email=npm@oneuptime.com" >> ~/.npmrc
publish_to_npm() {
directory_name=$1
echo "Publishing $directory_name@$package_version to npm"
cd $directory_name
npm version $package_version
# Before npm install, replace "Common": "file:../Common" with "@oneuptime/common": "$package_version" in package.json
sed -i "s/\"Common\": \"file:..\/Common\"/\"@oneuptime\/common\": \"$package_version\"/g" package.json
# Before npm install, replace "CommonServer": "file:../CommonServer" with "@oneuptime/common-server": "$package_version" in package.json
sed -i "s/\"CommonServer\": \"file:..\/CommonServer\"/\"@oneuptime\/common-server\": \"$package_version\"/g" package.json
# Before npm install, replace "Model": "file:../Model" with "@oneuptime/model": "$package_version" in package.json
sed -i "s/\"Model\": \"file:..\/Model\"/\"@oneuptime\/model\": \"$package_version\"/g" package.json
# Before npm install, replace "CommonUI": "file:../CommonUI" with "@oneuptime/common-ui": "$package_version" in package.json
sed -i "s/\"CommonUI\": \"file:..\/CommonUI\"/\"@oneuptime\/common-ui\": \"$package_version\"/g" package.json
npm install
npm run compile
npm publish --tag latest
}
publish_to_npm "Common"
publish_to_npm "Model"
publish_to_npm "CommonServer"
publish_to_npm "CommonUI"
publish_to_npm "InfrastructureAgent"