circleci push release version to github

This commit is contained in:
BryceLTaylor 2022-04-20 15:59:10 -04:00
parent deb3745f77
commit 85ca4a73e3

View file

@ -29,13 +29,11 @@ aliases:
command: | command: |
RELEASE_TIMESTAMP="$(date +'%Y%m%d%H%M%S')" RELEASE_TIMESTAMP="$(date +'%Y%m%d%H%M%S')"
VPKG=$($(npm bin)/json -f package.json version) VPKG=$($(npm bin)/json -f package.json version)
export RELEASE_VERSION=${VPKG}-prerelease.${RELEASE_TIMESTAMP} echo export RELEASE_VERSION=${VPKG}-prerelease.${RELEASE_TIMESTAMP} >> $BASH_ENV
echo $RELEASE_VERSION
echo export NPM_TAG=latest >> $BASH_ENV echo export NPM_TAG=latest >> $BASH_ENV
if [[ "$CIRCLE_BRANCH" == hotfix/* ]]; then # double brackets are important for matching the wildcard if [[ "$CIRCLE_BRANCH" == hotfix/* ]]; then # double brackets are important for matching the wildcard
echo export NPM_TAG=hotfix >> $BASH_ENV echo export NPM_TAG=hotfix >> $BASH_ENV
fi fi
npm version --no-git-tag-version $RELEASE_VERSION
- &deploy-gh-pages - &deploy-gh-pages
name: "deploy to gh pages" name: "deploy to gh pages"
command: | command: |
@ -45,9 +43,17 @@ aliases:
- &deploy-npm - &deploy-npm
name: "deploy to npm" name: "deploy to npm"
command: | command: |
echo $NPM_TAG echo "npm tag: $NPM_TAG"
echo "release version: $RELEASE_VERSION"
npm version --no-git-tag-version $RELEASE_VERSION
npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN
npm publish --tag $NPM_TAG npm publish --tag $NPM_TAG
- &tag-commit
name: "tag commit in github"
command: |
echo $RELEASE_VERSION
git tag $RELEASE_VERSION
git push $CIRCLE_REPOSITORY_URL $RELEASE_VERSION
jobs: jobs:
build-test: build-test:
@ -84,6 +90,8 @@ jobs:
<<: *deploy-gh-pages <<: *deploy-gh-pages
- run: - run:
<<: *deploy-npm <<: *deploy-npm
- run:
<<: *tag-commit
workflows: workflows:
build-test-no-deploy: build-test-no-deploy: