ci: setup lerna version/publish CI workflow

This commit is contained in:
Hank Stoever
2020-02-28 15:09:27 -08:00
parent 181dde57ee
commit 6615de7f35
7 changed files with 120 additions and 67 deletions

View File

@@ -1,34 +0,0 @@
name: Codecheck
on: [push]
jobs:
codecheck:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Set Node Version
uses: actions/setup-node@v1
with:
node-version: 12.16.1
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Monorepo Dependencies
run: yarn --frozen-lockfile
- name: Lerna Bootstrap
run: yarn lerna bootstrap
- name: Lint
run: yarn lint
- name: Depcheck
run: yarn lerna run depcheck --parallel
- name: Typecheck
run: yarn lerna run typecheck --parallel

109
.github/workflows/main.yml vendored Normal file
View File

@@ -0,0 +1,109 @@
name: UX
on: [push]
jobs:
test_keychain:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Set Node Version
uses: actions/setup-node@v1
with:
node-version: 12.16.1
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install monorepo deps
run: yarn
- name: Install Keychain dependencies
run: yarn
working-directory: ./packages/keychain
- name: Keychain tests
run: yarn lerna run test --scope @blockstack/keychain
codecheck:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Set Node Version
uses: actions/setup-node@v1
with:
node-version: 12.16.1
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Monorepo Dependencies
run: yarn --frozen-lockfile
- name: Lerna Bootstrap
run: yarn lerna bootstrap
- name: Lint
run: yarn lint
- name: Depcheck
run: yarn lerna run depcheck --parallel
- name: Typecheck
run: yarn lerna run typecheck --parallel
publish:
needs: [test_keychain, codecheck]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Checkout master
run: git checkout master
- name: Set Node Version
uses: actions/setup-node@v1
with:
node-version: 12.16.1
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install monorepo deps
run: yarn
- name: Git status
run: git status
- name: Install package deps
run: yarn lerna exec --parallel "yarn"
- name: Git status
run: git status
- name: Setup .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
- name: Setup git
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
- name: Lerna Version
run: yarn lerna version --conventional-commits --no-push --yes
- name: Publish
run: yarn lerna publish from-git --conventional-commits --yes
- name: Push changes
uses: ad-m/github-push-action@fe38f0a
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,30 +0,0 @@
name: Test (Keychain)
on: [push]
jobs:
test_keychain:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Set Node Version
uses: actions/setup-node@v1
with:
node-version: 12.16.1
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install monorepo deps
run: yarn
- name: Install Keychain dependencies
run: yarn
working-directory: ./packages/keychain
- name: Keychain tests
run: yarn lerna run test --scope @blockstack/keychain

View File

@@ -3,5 +3,10 @@
"packages/*"
],
"version": "independent",
"npmClient": "yarn"
"npmClient": "yarn",
"command": {
"version": {
"message": "chore(release): publish"
}
}
}

View File

@@ -35,7 +35,8 @@
"lint": "yarn lint:eslint && yarn lint:prettier",
"lint:eslint": "eslint --ext .ts,.tsx . -f unix",
"lint:fix": "eslint --ext .ts,.tsx . -f unix --fix && prettier --write **/*.{ts,tsx} *.js",
"lint:prettier": "prettier --check **/*.{ts,tsx} *.js"
"lint:prettier": "prettier --check **/*.{ts,tsx} *.js",
"version": "lerna bootstrap"
},
"prettier": "@blockstack/prettier-config",
"husky": {

View File

@@ -17,6 +17,7 @@
"test:coverage": "jest --collect-coverage",
"test:watch": "jest --watch",
"typecheck": "tsc --noEmit",
"version": "yarn",
"watch": "cross-env NODE_ENV=development EXT_ENV=watch webpack -d"
},
"version": "1.0.0",

View File

@@ -79,7 +79,8 @@
"prepublishOnly": "yarn build",
"start": "tsdx watch",
"test": "tsdx test",
"typecheck": "tsc --noEmit"
"typecheck": "tsc --noEmit",
"version": "yarn"
},
"sideEffects": false,
"typings": "dist/index.d.ts",