diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md new file mode 100644 index 000000000..d99cfd3e1 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md @@ -0,0 +1,14 @@ +Please ensure your PR is named in accordance with the [@commitlint/config-conventional](https://github.com/conventional-changelog/commitlint/tree/master/@commitlint/config-conventional#type-enum) standard. + +Prefixes can be one of the following characters +``` +['build', 'chore', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'style', 'test'] +``` + +✅ Examples of conforming PR titles: + +``` +feat: widgets can now do backflips +fix: something was broken +test: added more coverage to widget +``` diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 190dbcf14..391e43939 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -1,4 +1,4 @@ -name: commitlint/lint/test/build +name: Commitlint Lint Test & Build on: pull_request: @@ -14,8 +14,6 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 - - name: Commit lint - uses: wagoid/commitlint-github-action@v4 - name: Cache dependencies uses: actions/cache@v2 with: @@ -23,6 +21,9 @@ jobs: key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} - name: Install run: yarn install --frozen-lockfile + # needs to run after install + - name: Commitlint PR title + run: echo ${{ github.event.pull_request.title }} | npx commitlint - name: Type check run: yarn type-check - name: Lint diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..34f9e209d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,37 @@ +name: Release +on: + push: + branches: + - main + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Commit lint + uses: wagoid/commitlint-github-action@v4 + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: '**/node_modules' + key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} + - name: Install + run: yarn install --frozen-lockfile + - name: Type check + run: yarn type-check + - name: Lint + run: yarn lint + - name: Test + run: yarn test + - name: Build + run: yarn build + - name: Release + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + GH_TOKEN: ${{ secrets.GH_TOKEN }} + run: yarn release diff --git a/.releaserc.json b/.releaserc.json index b5bed5716..5ee2e6b4e 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -1,22 +1,28 @@ { - "branches": "develop", + "branches": ["main"], "repositoryUrl": "https://github.com/shapeshift/lib", "debug": "true", "plugins": [ - "@semantic-release/commit-analyzer", + ["@semantic-release/commit-analyzer", { + "preset": "angular", + "releaseRules": [ + { "type": "chore", "release": "patch" }, + { "type": "test", "release": "patch" } + ] + }], "@semantic-release/release-notes-generator", - "@semantic-release/npm", - "@semantic-release/github", [ "@semantic-release/changelog", { "changelogFile": "CHANGELOG.md" } ], + "@semantic-release/npm", + "@semantic-release/github", [ "@semantic-release/git", { - "assets": ["package.json", "package-lock.json", "CHANGELOG.md"], + "assets": ["dist/**", "package.json", "package-lock.json", "CHANGELOG.md"], "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" } ] diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..e69de29bb diff --git a/package.json b/package.json index 48a445581..814f87123 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "test": "jest", "test:dev": "jest --watch", "type-check": "lerna run type-check", + "release": "lerna exec --concurrency 1 -- npx --no-install semantic-release -e semantic-release-monorepo", "publish:lerna": "lerna publish from-package --no-private --yes", "version:patch": "lerna version patch --yes --no-git-tag-version --no-push", "version:minor": "lerna version minor --yes --no-git-tag-version --no-push",