diff --git a/.github/workflows/triage.yml b/.github/workflows/triage.yml index 6e49517..2e8a368 100644 --- a/.github/workflows/triage.yml +++ b/.github/workflows/triage.yml @@ -6,31 +6,37 @@ jobs: commitlint: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v4 with: fetch-depth: 0 - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: '20' - - name: Set up pnpm uses: pnpm/action-setup@v4 with: version: 9 + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + registry-url: 'https://registry.npmjs.org/' + always-auth: true + cache: pnpm + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} + - name: Install Dependencies + run: pnpm install - name: Print versions run: | git --version node --version pnpm --version - pnpm dlx commitlint --version - + pnpm commitlint --version + - name: Validate current commit (last commit) with commitlint if: github.event_name == 'push' - run: pnpm dlx commitlint --last --verbose + run: pnpm commitlint --last --verbose - name: Validate PR commits with commitlint if: github.event_name == 'pull_request' - run: pnpm dlx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose \ No newline at end of file + run: pnpm commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose \ No newline at end of file diff --git a/package.json b/package.json index c845ffa..d931282 100644 --- a/package.json +++ b/package.json @@ -20,14 +20,6 @@ "license": "ISC", "devDependencies": { "@commitlint/cli": "^19.5.0", - "@commitlint/config-conventional": "^19.5.0", - "@favware/npm-deprecate": "^1.0.7", - "@semantic-release/changelog": "^6.0.3", - "husky": "^9.1.6", - "semantic-release": "^24.1.2" - }, - "publishConfig": { - "access": "public", - "provenance": true + "@commitlint/config-conventional": "^19.5.0" } -} +} \ No newline at end of file diff --git a/packages/test1/package.json b/packages/test1/package.json index 2636765..84eb388 100644 --- a/packages/test1/package.json +++ b/packages/test1/package.json @@ -22,6 +22,11 @@ "keywords": [], "author": "", "license": "ISC", + "devDependencies": { + "@favware/npm-deprecate": "^1.0.7", + "@semantic-release/changelog": "^6.0.3", + "semantic-release": "^24.1.2" + }, "publishConfig": { "access": "public", "provenance": true diff --git a/release.config.cjs b/packages/test1/release.config.cjs similarity index 100% rename from release.config.cjs rename to packages/test1/release.config.cjs diff --git a/packages/test2/package.json b/packages/test2/package.json index 0e439af..e43e69f 100644 --- a/packages/test2/package.json +++ b/packages/test2/package.json @@ -22,11 +22,16 @@ "keywords": [], "author": "", "license": "ISC", - "publishConfig": { - "access": "public", - "provenance": true + "devDependencies": { + "@favware/npm-deprecate": "^1.0.7", + "@semantic-release/changelog": "^6.0.3", + "semantic-release": "^24.1.2" }, "dependencies": { "@lasfoiawbp/test1": "workspace:^" + }, + "publishConfig": { + "access": "public", + "provenance": true } } \ No newline at end of file diff --git a/packages/test2/release.config.cjs b/packages/test2/release.config.cjs new file mode 100644 index 0000000..a0d8dc0 --- /dev/null +++ b/packages/test2/release.config.cjs @@ -0,0 +1,77 @@ +const { BRANCH_NAME: branch } = process.env; + +const commitAnalyzerConfig = [ + '@semantic-release/commit-analyzer', + { + preset: 'conventionalcommits', + releaseRules: [ + { + type: 'feat', + release: 'minor', + }, + { + type: 'fix', + release: 'patch', + }, + { + type: 'docs', + release: 'patch', + }, + { + type: 'chore', + release: false, + }, + { + type: 'ci', + release: false, + }, + { + type: 'refactor', + release: 'patch', + }, + { + type: 'perf', + release: 'patch', + }, + { + type: 'style', + release: 'patch', + }, + ], + }, + ], + gitConfig = [ + '@semantic-release/github', + { + successComment: false, + failTitle: false, + }, + ]; + +/** + * @type {import('semantic-release').GlobalConfig} + */ +module.exports = { + branches: [ + { + name: 'stable', + channel: 'latest', + prerelease: false, + }, + { + name: 'main', + channel: 'dev', + prerelease: 'dev', + }, + ], + plugins: + branch === 'stable' + ? [ + commitAnalyzerConfig, + '@semantic-release/release-notes-generator', + '@semantic-release/changelog', + '@semantic-release/npm', + gitConfig, + ] + : [commitAnalyzerConfig, '@semantic-release/npm'], +};