mirror of
https://github.com/tenrok/BBob.git
synced 2026-06-23 20:40:34 +03:00
* feat: add ability to prepublish canary versions * fix: ci * fix: pr comment * fix: ci pr * fix: ci pr env * fix: github env name * fix: github file ignoring * fix: yml syntax * fix: codeql * fix: syntax error * fix: pnpm version * fix: remove node 16.x support * fix: workspace name * fix: workspace pnpm * fix: workspace with pnpm * ci: changeset publish * ci: changeset pr name * ci: pr * ci: fix pr.yml * ci: fix pr.yml workspaces * ci: fix steps order in pr.yml * ci: fix pr publish error * ci: fix npm publish tag to alpha * ci: npm publish tag * ci: npm publish tag * ci: fix tag with PR number
This commit is contained in:
@@ -17,7 +17,7 @@ jobs:
|
|||||||
- name: Install PNPM
|
- name: Install PNPM
|
||||||
uses: pnpm/action-setup@v3
|
uses: pnpm/action-setup@v3
|
||||||
with:
|
with:
|
||||||
version: 8
|
version: 9.4.0
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ jobs:
|
|||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v1
|
uses: github/codeql-action/init@v2
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
@@ -49,7 +49,7 @@ jobs:
|
|||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
# If this step fails, then you should remove it and run the build manually (see below)
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@v1
|
uses: github/codeql-action/autobuild@v2
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
# 📚 https://git.io/JvXDl
|
# 📚 https://git.io/JvXDl
|
||||||
@@ -63,4 +63,4 @@ jobs:
|
|||||||
# make release
|
# make release
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v1
|
uses: github/codeql-action/analyze@v2
|
||||||
|
|||||||
@@ -0,0 +1,96 @@
|
|||||||
|
name: Pull Request
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths-ignore:
|
||||||
|
- '.changeset/**'
|
||||||
|
- '.husky/**'
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ci-pull-request=${{github.ref}}-1
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read # Read-only access to repository contents
|
||||||
|
issues: write # Write access to issues
|
||||||
|
pull-requests: write # Write access to pull requests
|
||||||
|
statuses: write # Write access to commit statuses
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: 'Build & pre-alpha release'
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
env:
|
||||||
|
NODE_OPTIONS: --max-old-space-size=4096
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set SHA
|
||||||
|
id: sha
|
||||||
|
run: |
|
||||||
|
SHORT_SHA=$(git rev-parse --short "$GITHUB_SHA")
|
||||||
|
echo "short_sha=${SHORT_SHA}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Install pnpm
|
||||||
|
uses: pnpm/action-setup@v3
|
||||||
|
with:
|
||||||
|
version: 9.4.0
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version-file: '.nvmrc'
|
||||||
|
cache: 'pnpm'
|
||||||
|
|
||||||
|
- name: Increment alpha
|
||||||
|
run: npm version 0.0.0-alpha.${{ steps.sha.outputs.short_sha }} --preid pr_${{ github.event.number }} --allow-same-version --workspace="packages/**" --if-present --no-git-tag-version
|
||||||
|
|
||||||
|
- name: Install
|
||||||
|
run: pnpm install --frozen-lockfile --strict-peer-dependencies
|
||||||
|
|
||||||
|
- name: Build project
|
||||||
|
run: pnpm build
|
||||||
|
|
||||||
|
- name: Setup npmrc
|
||||||
|
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
|
||||||
|
|
||||||
|
- name: Publish alpha
|
||||||
|
run: npm publish --workspace="packages/**" --tag=pr_${{ github.event.number }} --access=public
|
||||||
|
|
||||||
|
- name: Comment PR
|
||||||
|
uses: actions/github-script@v6
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
script: |
|
||||||
|
const setMessage = require('${{ github.workspace }}/scripts/ci/set-message')
|
||||||
|
|
||||||
|
await setMessage({
|
||||||
|
header: `## @bbob NPM alpha release`,
|
||||||
|
body: `
|
||||||
|
@bbob/cli [0.0.0-alpha.${{ steps.sha.outputs.short_sha }}](https://www.npmjs.com/package/@bbob/cli/v/0.0.0-alpha.${{ steps.sha.outputs.short_sha }})
|
||||||
|
|
||||||
|
|
||||||
|
@bbob/core [0.0.0-alpha.${{ steps.sha.outputs.short_sha }}](https://www.npmjs.com/package/@bbob/core/v/0.0.0-alpha.${{ steps.sha.outputs.short_sha }})
|
||||||
|
@bbob/parser [0.0.0-alpha.${{ steps.sha.outputs.short_sha }}](https://www.npmjs.com/package/@bbob/parser/v/0.0.0-alpha.${{ steps.sha.outputs.short_sha }})
|
||||||
|
@bbob/plugin-helper [0.0.0-alpha.${{ steps.sha.outputs.short_sha }}](https://www.npmjs.com/package/@bbob/plugin-helper/v/0.0.0-alpha.${{ steps.sha.outputs.short_sha }})
|
||||||
|
@bbob/preset [0.0.0-alpha.${{ steps.sha.outputs.short_sha }}](https://www.npmjs.com/package/@bbob/preset/v/0.0.0-alpha.${{ steps.sha.outputs.short_sha }})
|
||||||
|
@bbob/types [0.0.0-alpha.${{ steps.sha.outputs.short_sha }}](https://www.npmjs.com/package/@bbob/types/v/0.0.0-alpha.${{ steps.sha.outputs.short_sha }})
|
||||||
|
|
||||||
|
|
||||||
|
@bbob/preset-html5 [0.0.0-alpha.${{ steps.sha.outputs.short_sha }}](https://www.npmjs.com/package/@bbob/preset-html5/v/0.0.0-alpha.${{ steps.sha.outputs.short_sha }})
|
||||||
|
@bbob/html [0.0.0-alpha.${{ steps.sha.outputs.short_sha }}](https://www.npmjs.com/package/@bbob/html/v/0.0.0-alpha.${{ steps.sha.outputs.short_sha }})
|
||||||
|
|
||||||
|
|
||||||
|
@bbob/preset-react [0.0.0-alpha.${{ steps.sha.outputs.short_sha }}](https://www.npmjs.com/package/@bbob/preset-react/v/0.0.0-alpha.${{ steps.sha.outputs.short_sha }})
|
||||||
|
@bbob/react [0.0.0-alpha.${{ steps.sha.outputs.short_sha }}](https://www.npmjs.com/package/@bbob/react/v/0.0.0-alpha.${{ steps.sha.outputs.short_sha }})
|
||||||
|
|
||||||
|
|
||||||
|
@bbob/preset-vue [0.0.0-alpha.${{ steps.sha.outputs.short_sha }}](https://www.npmjs.com/package/@bbob/preset-vue/v/0.0.0-alpha.${{ steps.sha.outputs.short_sha }})
|
||||||
|
@bbob/vue2 [0.0.0-alpha.${{ steps.sha.outputs.short_sha }}](https://www.npmjs.com/package/@bbob/vue2/v/0.0.0-alpha.${{ steps.sha.outputs.short_sha }})
|
||||||
|
@bbob/vue3 [0.0.0-alpha.${{ steps.sha.outputs.short_sha }}](https://www.npmjs.com/package/@bbob/vue3/v/0.0.0-alpha.${{ steps.sha.outputs.short_sha }})
|
||||||
|
`,
|
||||||
|
github,
|
||||||
|
repo: context.repo,
|
||||||
|
prNumber: context.payload.pull_request.number
|
||||||
|
})
|
||||||
@@ -20,7 +20,7 @@ jobs:
|
|||||||
- name: Install PNPM
|
- name: Install PNPM
|
||||||
uses: pnpm/action-setup@v3
|
uses: pnpm/action-setup@v3
|
||||||
with:
|
with:
|
||||||
version: 8
|
version: 9.4.0
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
@@ -31,11 +31,18 @@ jobs:
|
|||||||
- name: Install
|
- name: Install
|
||||||
run: pnpm install --frozen-lockfile --strict-peer-dependencies
|
run: pnpm install --frozen-lockfile --strict-peer-dependencies
|
||||||
|
|
||||||
|
- name: Prepare release version
|
||||||
|
id: pre_release
|
||||||
|
run: |
|
||||||
|
RELEASE_VER=$(pnpm changeset status --output=./release.json && node scripts/ci/release-version.js | tail -n 1)
|
||||||
|
echo "version=${RELEASE_VER}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Create Release Pull Request or Publish to npm
|
- name: Create Release Pull Request or Publish to npm
|
||||||
id: changesets
|
id: changesets
|
||||||
uses: changesets/action@v1
|
uses: changesets/action@v1
|
||||||
with:
|
with:
|
||||||
publish: npm run release
|
title: 'chore(release): publish ${{ steps.pre_release.outputs.version }}'
|
||||||
|
publish: pnpm release
|
||||||
commit: 'chore(release): release'
|
commit: 'chore(release): release'
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ jobs:
|
|||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [16.x, 18.x, 19.x]
|
node-version: [18.x, 19.x, 20.x]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
@@ -23,7 +23,7 @@ jobs:
|
|||||||
- name: Install PNPM
|
- name: Install PNPM
|
||||||
uses: pnpm/action-setup@v3
|
uses: pnpm/action-setup@v3
|
||||||
with:
|
with:
|
||||||
version: 8
|
version: 9.4.0
|
||||||
|
|
||||||
- name: Set up Node.js ${{ matrix.node-version }}
|
- name: Set up Node.js ${{ matrix.node-version }}
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
|
|||||||
+17
-8
@@ -25,10 +25,14 @@
|
|||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@bbob/scripts": "*",
|
||||||
"@changesets/changelog-github": "0.4.8",
|
"@changesets/changelog-github": "0.4.8",
|
||||||
"@changesets/cli": "2.26.2",
|
"@changesets/cli": "2.26.2",
|
||||||
"@commitlint/cli": "13.2.1",
|
"@commitlint/cli": "13.2.1",
|
||||||
"@commitlint/config-conventional": "13.2.0",
|
"@commitlint/config-conventional": "13.2.0",
|
||||||
|
"@nx/eslint": "18.3.3",
|
||||||
|
"@nx/jest": "18.3.3",
|
||||||
|
"@nx/rollup": "18.3.3",
|
||||||
"@rollup/plugin-commonjs": "25.0.7",
|
"@rollup/plugin-commonjs": "25.0.7",
|
||||||
"@rollup/plugin-node-resolve": "15.2.3",
|
"@rollup/plugin-node-resolve": "15.2.3",
|
||||||
"@rollup/plugin-replace": "5.0.5",
|
"@rollup/plugin-replace": "5.0.5",
|
||||||
@@ -38,6 +42,9 @@
|
|||||||
"@swc/jest": "0.2.36",
|
"@swc/jest": "0.2.36",
|
||||||
"@testing-library/dom": "9.3.1",
|
"@testing-library/dom": "9.3.1",
|
||||||
"@testing-library/jest-dom": "6.1.2",
|
"@testing-library/jest-dom": "6.1.2",
|
||||||
|
"@types/jest": "29.5.3",
|
||||||
|
"@types/node": "20.4.5",
|
||||||
|
"@types/react": "18.2.18",
|
||||||
"bundlesize2": "0.0.31",
|
"bundlesize2": "0.0.31",
|
||||||
"cross-env": "7.0.3",
|
"cross-env": "7.0.3",
|
||||||
"eslint": "7.32.0",
|
"eslint": "7.32.0",
|
||||||
@@ -60,14 +67,7 @@
|
|||||||
"rollup-plugin-gzip": "3.1.0",
|
"rollup-plugin-gzip": "3.1.0",
|
||||||
"rollup-plugin-swc3": "0.11.0",
|
"rollup-plugin-swc3": "0.11.0",
|
||||||
"size-limit": "11.0.1",
|
"size-limit": "11.0.1",
|
||||||
"typescript": "5.1.6",
|
"typescript": "5.1.6"
|
||||||
"@types/node": "20.4.5",
|
|
||||||
"@types/jest": "29.5.3",
|
|
||||||
"@types/react": "18.2.18",
|
|
||||||
"@nx/eslint": "18.3.3",
|
|
||||||
"@nx/rollup": "18.3.3",
|
|
||||||
"@nx/jest": "18.3.3",
|
|
||||||
"@bbob/scripts": "*"
|
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public",
|
"access": "public",
|
||||||
@@ -114,7 +114,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"workspaces": [
|
||||||
|
"packages/*",
|
||||||
|
"examples/*",
|
||||||
|
"scripts",
|
||||||
|
"benchmark"
|
||||||
|
],
|
||||||
"nx": {
|
"nx": {
|
||||||
"includedScripts": []
|
"includedScripts": []
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"dedent": "1.5.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { createPreset, PresetTagsDefinition } from '../src';
|
import { createPreset } from '../src';
|
||||||
import { BBobCoreOptions, createTree } from '@bbob/core'
|
import { createTree } from '@bbob/core'
|
||||||
|
import type { PresetTagsDefinition, BBobCoreOptions } from '@bbob/types';
|
||||||
|
|
||||||
describe('@bbob/preset', () => {
|
describe('@bbob/preset', () => {
|
||||||
const presetFactory = <Tags extends PresetTagsDefinition = PresetTagsDefinition>(defTags: Tags) => {
|
const presetFactory = <Tags extends PresetTagsDefinition = PresetTagsDefinition>(defTags: Tags) => {
|
||||||
|
|||||||
@@ -2,3 +2,6 @@ dist
|
|||||||
es
|
es
|
||||||
lib
|
lib
|
||||||
test
|
test
|
||||||
|
types
|
||||||
|
test/*.d.ts
|
||||||
|
test/*.map
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#@bbob/types
|
||||||
|
Shared types of @bbob project
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install --save-dev @bbob/types
|
||||||
|
```
|
||||||
Generated
+11823
-10170
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,8 @@
|
|||||||
|
const config = require('../release.json');
|
||||||
|
const {unlink} = require('fs')
|
||||||
|
|
||||||
|
const commit_message = `v${config.releases[0].newVersion}`
|
||||||
|
|
||||||
|
unlink('./release.json', () => {})
|
||||||
|
|
||||||
|
console.log(commit_message)
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
const dedent = require('dedent');
|
||||||
|
|
||||||
|
module.exports = async function setMessage({
|
||||||
|
header,
|
||||||
|
body,
|
||||||
|
prNumber,
|
||||||
|
repo,
|
||||||
|
github,
|
||||||
|
}) {
|
||||||
|
const commentList = await github.paginate(
|
||||||
|
'GET /repos/:owner/:repo/issues/:issue_number/comments',
|
||||||
|
{
|
||||||
|
...repo,
|
||||||
|
issue_number: prNumber,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
const commentBody = dedent`
|
||||||
|
${header}
|
||||||
|
|
||||||
|
${body}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const comment = commentList.find((comment) => comment.body.startsWith(header));
|
||||||
|
|
||||||
|
if (!comment) {
|
||||||
|
await github.rest.issues.createComment({
|
||||||
|
...repo,
|
||||||
|
issue_number: prNumber,
|
||||||
|
body: commentBody,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
await github.rest.issues.updateComment({
|
||||||
|
...repo,
|
||||||
|
comment_id: comment.id,
|
||||||
|
body: commentBody,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user