Skip to content

Commit

Permalink
chore(ci): refactor automatic release using GH actions (#283)
Browse files Browse the repository at this point in the history
  • Loading branch information
mirceanis authored Dec 17, 2020
1 parent a5a0670 commit 3ec73b9
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 166 deletions.
152 changes: 0 additions & 152 deletions .circleci/config.yml

This file was deleted.

57 changes: 57 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build, Test and Publish
on: [push, workflow_dispatch]
jobs:
build-test-publish:
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
GH_TOKEN: ${{secrets.GH_TOKEN}}
GH_USER: ${{secrets.GH_USER}}
GH_EMAIL: ${{secrets.GH_EMAIL}}
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '12.x'

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install --frozen-lockfile
- run: yarn bootstrap
- run: yarn build
- run: yarn test:integration
- run: yarn lint
- run: npx codecov

- name: setup git coordinates
run: |
git remote set-url origin https://uport-project:$GH_TOKEN@github.com/uport-project/daf.git
git config user.name $GH_USER
git config user.email $GH_EMAIL
- name: setup npm registry
run: |
echo "registry=https://registry.npmjs.org/" > .npmrc
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
npm whoami
- name: publish @latest when on main
if: github.ref == 'refs/heads/main'
run: yarn publish:latest

- name: publish @next when on next
if: github.ref == 'refs/heads/next'
run: yarn publish:next
17 changes: 17 additions & 0 deletions .github/workflows/sync-next-with-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Sync @next with @latest
on:
workflow_dispatch:
push:
branches:
- 'main'
jobs:
merge-branch:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- uses: everlytic/branch-merge@1.1.0
with:
github_token: ${{ secrets.GH_TOKEN }}
source_ref: ${{ github.ref }}
target_branch: 'next'
commit_message_template: 'chore(ci): merge main into next'
2 changes: 1 addition & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'subject-case': [2, 'always', ['sentence-case']],
// 'subject-case': [2, 'always', ['sentence-case']],
},
}
14 changes: 3 additions & 11 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,12 @@
"command": {
"publish": {
"allowBranch": [
"master",
"beta"
"main",
"next"
],
"conventionalCommits": true,
"gitRemote": "origin",
"message": "chore(release): %s"
},
"version": {
"allowBranch": [
"beta"
],
"conventionalCommits": true,
"gitRemote": "origin",
"message": "chore(beta-release): %s"
"message": "chore(release): %s [skip ci]"
}
},
"useWorkspaces": true
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"build": "lerna run build && yarn build:schema-api",
"bootstrap": "lerna bootstrap",
"build:schema-api":"lerna run extract-api && lerna run generate-plugin-schema",
"lint": "echo \"linting not yet enabled\"",
"test:integration-build": "yarn test:integration-prepare && yarn test:integration-pretty",
"test:integration-prepare": "ts-node --project packages/tsconfig.settings.json ./scripts/prepare-integration-tests.ts",
"test:integration-pretty":"prettier --write __tests__/shared/documentationExamples.ts",
Expand All @@ -15,8 +16,8 @@
"daf": "./packages/daf-cli/bin/daf.js",
"prettier": "prettier --write '{packages,__tests__, !build}/**/*.{ts,js,json,md,yml}'",
"build-clean": "rimraf ./packages/*/build ./packages/*/node_modules ./packages/*/tsconfig.tsbuildinfo && jest --clearCache",
"publish": "lerna publish",
"publish-beta": "yarn build && npx lerna publish --canary premajor --preid beta --pre-dist-tag beta"
"publish:latest": "lerna publish --conventional-commits --include-merged-tags --create-release github --yes --registry https://registry.npmjs.org/:_authToken=${NPM_TOKEN}",
"publish:next": "lerna publish --conventional-prerelease --force-publish --canary --no-git-tag-version --include-merged-tags --preid next --pre-dist-tag next --yes --registry https://registry.npmjs.org/:_authToken=${NPM_TOKEN}"
},
"workspaces": [
"packages/*"
Expand Down

0 comments on commit 3ec73b9

Please sign in to comment.