Skip to content

Commit c4a62ce

Browse files
a7medevahmedAlaaInstabug
authored andcommitted
ci: publish snapshots to npm (#1274)
1 parent 6da1d7b commit c4a62ce

File tree

1 file changed

+11
-24
lines changed

1 file changed

+11
-24
lines changed

.circleci/config.yml

+11-24
Original file line numberDiff line numberDiff line change
@@ -469,35 +469,22 @@ jobs:
469469
- run: yarn build
470470
- run: yarn remove @instabug/danger-plugin-coverage
471471
- run:
472-
name: Remove build files from .gitignore
473-
command: sed -i '/dist/d' .gitignore && sed -i '/bin/d' .gitignore
474-
- run:
475-
name: Get snapshot branch name
476-
command: |
477-
source scripts/snapshot-branch.sh
478-
echo "export SNAPSHOT_BRANCH=$SNAPSHOT_BRANCH" >> "$BASH_ENV"
479-
- run:
480-
name: Setup Git
481-
command: |
482-
git config --global user.name "Instabug-CP-CI"
483-
git config --global user.email [email protected]
484-
- run:
485-
name: Create snapshot branch
486-
command: git checkout -b $SNAPSHOT_BRANCH
487-
- run:
488-
name: Commit changes
472+
name: Get snapshot version
489473
command: |
490-
git add .
491-
git commit -m "chore: add generate files"
474+
source scripts/snapshot-version.sh
475+
echo "export SNAPSHOT_VERSION=$SNAPSHOT_VERSION" >> "$BASH_ENV"
492476
- run:
493-
name: Push snapshot
494-
command: git push --force origin $SNAPSHOT_BRANCH
477+
name: Authorize with NPM
478+
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
479+
- run: npm version $SNAPSHOT_VERSION --no-git-tag-version
480+
- run: npm publish --tag snapshot
495481
- run:
496482
name: Install jq
497483
command: sudo apt-get update && sudo apt-get install -y jq
498-
- run:
499-
name: Replace snapshot branch in comment template
500-
command: sed -i "s|{BRANCH}|$SNAPSHOT_BRANCH|g" scripts/snapshot-comment.md
484+
- find_and_replace:
485+
files: scripts/snapshot-comment.md
486+
search: '{VERSION}'
487+
replace: $SNAPSHOT_VERSION
501488
- notify_github:
502489
data: "$(jq -Rcs '{ body: . }' scripts/snapshot-comment.md)"
503490

0 commit comments

Comments
 (0)