Skip to content

Commit

Permalink
Merge pull request #2 from identity-com/feature/build-version
Browse files Browse the repository at this point in the history
Set the release process and update docs
  • Loading branch information
lucmir authored Sep 23, 2019
2 parents f1f7481 + 249a98d commit 36befdd
Show file tree
Hide file tree
Showing 32 changed files with 5,208 additions and 288 deletions.
91 changes: 91 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,42 @@ workflows:
jobs:
- build

build-tag:
jobs:
- build:
filters:
tags:
only: /^release\..*$/
branches:
ignore: /.*/
- release:
context: Production
requires:
- build
filters:
tags:
only: /^release\..*$/
branches:
ignore: /.*/

deploy-npm:
jobs:
- build:
filters:
tags:
only: /^v\d+\.\d+\.\d+.*/
branches:
ignore: /.*/
- deploy:
context: Production
requires:
- build
filters:
tags:
only: /^v\d+\.\d+\.\d+.*/
branches:
ignore: /.*/


jobs:
build:
Expand All @@ -39,3 +75,58 @@ jobs:
- persist_to_workspace:
root: ~/repo
paths: .

release:
<<: *defaults
environment:
HUB_ARTIFACT_VERSION: 2.7.0
HUB_ARTIFACT: hub-linux-amd64-2.7.0
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}-{{checksum "package-lock.json"}}
- run: sudo apt-get update
- run: sudo npm install -g npm
- run: |
sh ./.circleci/install_hub.sh
mkdir -p ~/.config/ && echo -e "github.com:\n- user: civictechuser\n oauth_token: $GITHUB_API_KEY\n protocol: https\n" > ~/.config/hub
- run: npm ci
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}-{{checksum "package-lock.json"}}
- run:
name: run lint check
command: npm run lint
- run:
name: run tests
command: npm run test
- run: npm run build
- run:
name: git config
command: |
git config credential.helper 'cache --timeout=120'
git config user.email "[email protected]"
git config user.name "CI Deployer"
git config --global push.default simple
- run:
name: create release
command: npm run release:create
- run:
name: delete release tag
command: git push --delete origin $CIRCLE_TAG
- run: |
hub release delete $CIRCLE_TAG
deploy:
<<: *defaults
steps:
- attach_workspace:
at: ~/repo
- run:
name: authenticate with registry
command: echo "//registry.npmjs.org/:_authToken=$IDENTITY_NPM_TOKEN" > ~/repo/.npmrc
- run:
name: publish package
command: npm publish --access=public
14 changes: 14 additions & 0 deletions .circleci/install_hub.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
set -e

mkdir -p .hub_tmp
cd .hub_tmp

if [ ! -f "$HUB_ARTIFACT.tgz" ]; then
wget https://github.com/github/hub/releases/download/v$HUB_ARTIFACT_VERSION/$HUB_ARTIFACT.tgz
fi

tar -xvzf $HUB_ARTIFACT.tgz
sudo ./$HUB_ARTIFACT/install

rm -rf ./$HUB_ARTIFACT
2 changes: 1 addition & 1 deletion docs/assets/js/search.js

Large diffs are not rendered by default.

Loading

0 comments on commit 36befdd

Please sign in to comment.