Add publish step for Infrastructure Agent

This commit is contained in:
Simon Larsen 2024-03-13 11:20:53 +00:00
parent 4e99b45c2e
commit 17483bc03e
No known key found for this signature in database
GPG Key ID: AB45983AA9C81CDE
3 changed files with 52 additions and 1 deletions

View File

@ -10,6 +10,20 @@ on:
jobs:
publish-infrastucture-agent:
runs-on: ubuntu-latest
env:
CI_PIPELINE_ID: ${{github.run_number}}
NPM_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
PACKAGE_VERSION: 7.0.${{github.run_number}}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Preinstall
run: npm run prerun
- name: Publish Infrastructure Agent
run: cd InfrastructureAgent && npm run publish
docker-build-accounts:
runs-on: ubuntu-latest
env:

View File

@ -11,7 +11,8 @@
"audit": "npm audit --audit-level=low",
"dep-check": "npm install -g depcheck && depcheck ./ --skip-missing=true",
"test": "rm -rf build && jest --detectOpenHandles",
"coverage": "jest --detectOpenHandles --coverage"
"coverage": "jest --detectOpenHandles --coverage",
"publish": "PACKAGE_NAME=@oneuptime/infrastructure-agent && bash ../Scripts/NPM/Publish.sh"
},
"author": "",
"license": "ISC",

View File

@ -0,0 +1,36 @@
# Set the package name and version
package_name=$PACKAGE_NAME
package_version=$PACKAGE_VERSION
# If no package name is provided, exit
if [ -z "$package_name" ]; then
echo "Package name is required"
exit 1
fi
# 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
# 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