Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

feat: add double publishing to github registry #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .buddy/double-publish-github-registry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
- pipeline: "Double publish module to NPM & github"
trigger_mode: "ON_EVERY_PUSH"
ref_name: "refs/tags/*"
ref_type: "WILDCARD"
priority: "NORMAL"
fetch_all_refs: true
trigger_condition: "ALWAYS"
actions:
- action: 'Execute: npm publish for github (new) registry'
type: 'BUILD'
working_directory: "/buddy/xendit-js-node"
docker_image_name: 'library/node'
docker_image_tag: '10'
execute_commands:
# move to client path
- "cd $CLIENT_PATH"
# Add tokens for github and NPM
- 'echo -ne "# npm registry config\n//registry.npmjs.org/:_authToken=$NPM_PUBLISH_TOKEN\n@boxbag:registry=https://registry.npmjs.org/\n\r# github registry config\n//npm.pkg.github.com/:_authToken=$GITHUB_REGISTRY_TOKEN\n@xendit:registry=https://npm.pkg.github.com/" >> .npmrc'
# update package's scope to publish to NPM boxbag's registry
- "if [[ $BUDDY_EXECUTION_TAG != v$(node -p -e \"require('./package.json').version\") ]];"
- "then"
- " echo \"Github release tag does not match package.json version tag\""
- " exit 1"
- "fi"
- sed -ie '/name/s/@xendit/@boxbag/' package.json
- npm install
# remove/modify this line if you have a different build script
- npm run build
- npm publish

# publish
# update package's scope to publish to xendit's github registry
- 'sedRepoString=", \"repository\": { \"type\": \"git\", \"url\": \"git+https:\/\/github.com\/xendit\/xendit-js-node.git\" }"'
- 'sed -i -e "$(( $( wc -l < package.json) -1 ))s/$/\n$sedRepoString/" package.json'
- sed -ie '/name/s/@boxbag/@xendit/' package.json
- "npm ci"
- "npm publish"
- rm .npmrc
volume_mappings:
- "/:/buddy/xendit-js-node"
trigger_condition: 'ALWAYS'
ignore_errors: true
shell: 'BASH'