Skip to content

Commit

Permalink
fixup: automation
Browse files Browse the repository at this point in the history
Signed-off-by: Todd Baert <[email protected]>
  • Loading branch information
toddbaert committed Oct 30, 2023
1 parent 276d858 commit 8e6db5b
Show file tree
Hide file tree
Showing 15 changed files with 135 additions and 74 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/audit-pending-releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
on:
push:
branches:
- 'release-please**'

env:
CORE_PACKAGE: core

name: Audit Pending Releases
jobs:
npm-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.ref }}

# if this is an SDK release, make sure there's no pending releases for @openfeature/core
- name: Check for Pending Dependency PRs
if: ${{ !endsWith(github.ref_name, env.CORE_PACKAGE) }}
run: |
if [ $(gh pr list --search '"release ${{ env.CORE_PACKAGE }}" in:title' | wc -l) -gt 0 ]; \
then echo "Pending @openfeaure/${{ env.CORE_PACKAGE }} release. Please release @openfeaure/${{ env.CORE_PACKAGE }} first!" && exit 1; \
else echo "No pending @openfeaure/${{ env.CORE_PACKAGE }} releases"; \
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 16
registry-url: "https://registry.npmjs.org"
cache: 'npm'

# if this is an @openfeature/core release, but the SDKs to use this version as a peer, and commit back
- name: Update Peer Version in Dependants
if: ${{ endsWith(github.ref_name, env.CORE_PACKAGE) }}
run: |
npm run update-core-peers && \
! git diff-files --quiet && \
( echo 'Updated peer dependency in dependants, commiting...'
git add --all && \
git config user.name "openfeature-peer-update-bot" && \
git config user.email "[email protected]" && \
git commit -m 'chore: bump @openfeaure/${{ env.CORE_PACKAGE }} peer' -s && \
git push ) || echo 'Peer dependency in dependants is already up to date.'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72 changes: 34 additions & 38 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"clean": "shx rm -rf ./dist",
"build": "npm run build --workspace=packages/shared --workspace=packages/server --workspace=packages/client --workspace=packages/react",
"publish-all": "npm run publish-if-not-exists --workspace=packages/server --workspace=packages/client --workspace=packages/react",
"docs": "typedoc"
"docs": "typedoc",
"core-version": "npm run version --workspace=packages/shared",
"update-core-peers": "export OPENFEATURE_CORE_VERSION=$(npm run --silent core-version) && npm run update-core-peer --workspace=packages/server --workspace=packages/client --workspace=packages/react"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -66,7 +68,7 @@
"shx": "^0.3.4",
"ts-jest": "^29.0.5",
"ts-node": "^10.8.2",
"typedoc": "^0.24.8",
"typedoc": "^0.25.3",
"typescript": "^4.7.4",
"uuid": "^9.0.0"
},
Expand Down
6 changes: 1 addition & 5 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"current-version": "echo $npm_package_version",
"prepack": "shx cp ./../../LICENSE ./LICENSE",
"publish-if-not-exists": "cp $NPM_CONFIG_USERCONFIG .npmrc && if [ \"$(npm show $npm_package_name@$npm_package_version version)\" = \"$(npm run current-version -s)\" ]; then echo 'already published, skipping'; else npm publish --access public; fi",
"docs": "typedoc"
"update-core-peer": "npm install --save-peer --save-exact @openfeature/core@$OPENFEATURE_CORE_VERSION"
},
"repository": {
"type": "git",
Expand All @@ -50,9 +50,5 @@
},
"devDependencies": {
"@openfeature/core": "*"
},
"typedoc": {
"displayName": "OpenFeature Web SDK",
"entryPoint": "./src/index.ts"
}
}
8 changes: 8 additions & 0 deletions packages/client/typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://typedoc.org/schema.json",
"name": "@openfeature/web-sdk",
"includeVersion": true,
"entryPoints": [
"src/index.ts",
]
}
10 changes: 3 additions & 7 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"current-version": "echo $npm_package_version",
"prepack": "shx cp ./../../LICENSE ./LICENSE",
"publish-if-not-exists": "cp $NPM_CONFIG_USERCONFIG .npmrc && if [ \"$(npm show $npm_package_name@$npm_package_version version)\" = \"$(npm run current-version -s)\" ]; then echo 'already published, skipping'; else npm publish --access public; fi",
"docs": "typedoc"
"update-core-peer": "npm install --save-peer --save-exact @openfeature/core@$OPENFEATURE_CORE_VERSION"
},
"repository": {
"type": "git",
Expand All @@ -47,16 +47,12 @@
},
"homepage": "https://github.com/open-feature/js-sdk#readme",
"peerDependencies": {
"react": ">=18.0.0",
"@openfeature/core": ">=0.1.0",
"@openfeature/web-sdk": ">=0.4.0"
"@openfeature/web-sdk": ">=0.4.0",
"react": ">=18.0.0"
},
"devDependencies": {
"@openfeature/core": "*",
"@openfeature/web-sdk": "*"
},
"typedoc": {
"displayName": "OpenFeature React SDK",
"entryPoint": "./src/index.ts"
}
}
8 changes: 8 additions & 0 deletions packages/react/typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://typedoc.org/schema.json",
"name": "@openfeature/react-sdk",
"includeVersion": true,
"entryPoints": [
"src/index.ts",
]
}
6 changes: 1 addition & 5 deletions packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"current-version": "echo $npm_package_version",
"prepack": "shx cp ./../../LICENSE ./LICENSE",
"publish-if-not-exists": "cp $NPM_CONFIG_USERCONFIG .npmrc && if [ \"$(npm show $npm_package_name@$npm_package_version version)\" = \"$(npm run current-version -s)\" ]; then echo 'already published, skipping'; else npm publish --access public; fi",
"docs": "typedoc"
"update-core-peer": "npm install --save-peer --save-exact @openfeature/core@$OPENFEATURE_CORE_VERSION"
},
"repository": {
"type": "git",
Expand All @@ -52,9 +52,5 @@
},
"devDependencies": {
"@openfeature/core": "*"
},
"typedoc": {
"displayName": "OpenFeature Server SDK",
"entryPoint": "./src/index.ts"
}
}
2 changes: 1 addition & 1 deletion packages/server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
"outDir": "./dist/esm", /* Specify an output folder for all emitted files. */
"outDir": "./dist", /* Specify an output folder for all emitted files. */
// "removeComments": true, /* Disable emitting comments. */
// "noEmit": true, /* Disable emitting files from a compilation. */
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
Expand Down
8 changes: 8 additions & 0 deletions packages/server/typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://typedoc.org/schema.json",
"name": "@openfeature/server-sdk",
"includeVersion": true,
"entryPoints": [
"src/index.ts",
]
}
2 changes: 1 addition & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"current-version": "echo $npm_package_version",
"prepack": "shx cp ./../../LICENSE ./LICENSE",
"publish-if-not-exists": "cp $NPM_CONFIG_USERCONFIG .npmrc && if [ \"$(npm show $npm_package_name@$npm_package_version version)\" = \"$(npm run current-version -s)\" ]; then echo 'already published, skipping'; else npm publish --access public; fi",
"docs": "typedoc"
"version": "echo $npm_package_version"
},
"repository": {
"type": "git",
Expand Down
10 changes: 3 additions & 7 deletions packages/shared/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
/* Language and Environment */
"target": "ES2015", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
"lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
"lib": [
"ES2020"
], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "jsx": "preserve", /* Specify what JSX code is generated. */
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
Expand Down Expand Up @@ -90,12 +92,6 @@
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
},
"typedocOptions": {
"name": "OpenFeature SDK",
"entryPoints": [
"src/index.ts"
]
},
"include": [
"./src/**/*"
],
Expand Down
8 changes: 8 additions & 0 deletions packages/shared/typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://typedoc.org/schema.json",
"name": "@openfeature/core",
"includeVersion": true,
"entryPoints": [
"src/index.ts",
]
}
Loading

0 comments on commit 8e6db5b

Please sign in to comment.