Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(monorepo): configure NX integrated repo and semantic release #55

Merged
merged 14 commits into from
Jul 31, 2023
Merged
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/libs/**/dist
/libs/**/coverage
78 changes: 33 additions & 45 deletions .github/workflows/npm-publish-github-packages.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,36 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: NPM Publish

on:
release:
types: [created]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: yarn

- name: Lint
run: yarn lint

- name: Check types
run: yarn check-types

- name: Test
run: yarn test

- name: Build
run: yarn build

publish-gpr:
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://npm.pkg.github.com/
- run: yarn
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
# name: NPM Publish

# on:
# release:
# types: [created]

# jobs:
# build:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-node@v3
# with:
# node-version: 16
# - name: Install dependencies
# run: yarn

# publish-gpr:
# needs: build
# runs-on: ubuntu-latest
# permissions:
# contents: read
# packages: write
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-node@v3
# with:
# node-version: 16
# registry-url: https://npm.pkg.github.com/
# - run: yarn
# - uses: JS-DevTools/npm-publish@v1
# with:
# token: ${{ secrets.NPM_TOKEN }}
17 changes: 17 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Release
on:
push:
branches:
- 'master'
jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: nrwl/nx-set-shas@v3
- run: yarn nx run-many release --parallel=1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
13 changes: 12 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
node_modules
/dist
/coverage
/coverage
/libs/**/dist
/libs/**/coverage

# Yarn 3 files
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/libs/**/dist
/libs/**/coverage
35 changes: 35 additions & 0 deletions .release.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const libName = 'bar'
const libPath = `libs/${libName}`
const importPath = `@my-org/${libName}`

module.exports = {
name: libName,
pkgRoot: `dist/${libPath}`,
tagFormat: artifactName + '-v${version}',
commitPaths: [`${libPath}/*`],
assets: [`${libPath}/README.md`, `${libPath}/CHANGELOG.md`],
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
[
'@semantic-release/changelog',
{
changelogFile: `${libPath}/CHANGELOG.md`
}
],
'@semantic-release/npm',
[
'@semantic-release/exec',
{
prepareCmd: ` PACKAGE_NAME=${importPath} VERSION=\${nextRelease.version} npm run update-deps && VERSION=\${nextRelease.version} npm run bump-version:${libName}`
}
],
[
'@semantic-release/git',
{
assets: [`${libPath}/CHANGELOG.md`],
message: `chore(release): ${libName}` + '-v${nextRelease.version} [skip ci]\n\n${nextRelease.notes}'
}
]
]
}
28 changes: 28 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

Large diffs are not rendered by default.

874 changes: 874 additions & 0 deletions .yarn/releases/yarn-3.6.1.cjs

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: '@yarnpkg/plugin-workspace-tools'

yarnPath: .yarn/releases/yarn-3.6.1.cjs
5 changes: 2 additions & 3 deletions apps/examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@
"author": "lukascivil",
"license": "MIT",
"dependencies": {
"json-difference": "^1.9.1"
"json-difference": "*"
},
"devDependencies": {
"@types/node": "^12.12.12",
"copyfiles": "^2.1.1",
"typescript": "4.4.3"
"copyfiles": "^2.1.1"
}
}
Loading
Loading