From 323ec2fb744000aa57abfff03b75ef28fbf40b27 Mon Sep 17 00:00:00 2001 From: Yaroslav Serhieiev Date: Mon, 21 Oct 2024 09:45:50 +0300 Subject: [PATCH] build: finish the jobs --- .github/workflows/ci.yml | 83 ++++++++++++++----- .github/workflows/release.yml | 36 -------- package.json | 3 +- .../multireplacer/executors/RegExpExecutor.ts | 11 ++- .../MultilingualSynsetSerializer.ts | 4 + 5 files changed, 73 insertions(+), 64 deletions(-) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bc664b4..c331a31 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,35 +1,72 @@ -name: CI +name: CI/CD Pipeline on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] - - workflow_dispatch: + branches: [main] jobs: - - main: - name: Default + lint: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: NPM install - uses: bahmutov/npm-install@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - useLockFile: false - - - name: Bootstrap - run: npm run bootstrap + node-version: '20' + cache: 'yarn' + - run: yarn install --frozen-lockfile + - run: yarn lint - - name: Lint - run: npm run lint:ci + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'yarn' + - run: yarn install --frozen-lockfile + - run: yarn test - - name: Build - run: npm run build + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'yarn' + - run: yarn install --frozen-lockfile + - run: yarn build + - uses: actions/upload-artifact@v4 + with: + name: dist + path: dist - - name: Test - run: npm run test + release: + needs: [lint, test, build] + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + permissions: + contents: write + issues: write + pull-requests: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'yarn' + - run: yarn install --frozen-lockfile + - uses: actions/download-artifact@v4 + with: + name: dist + path: dist + - name: Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npx semantic-release diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index e669005..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Release -on: - release: - types: - - published -jobs: - main: - name: Default - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: NPM install - uses: bahmutov/npm-install@v1 - with: - useLockFile: false - - - name: Bootstrap - run: npm run bootstrap - - - name: Build - run: npm run build - - - name: Release - run: 'npx lerna publish ${{ github.event.release.tag_name }} --yes --no-git-tag-version --no-push --exact --force-publish=*' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - - name: Commit changes - uses: EndBug/add-and-commit@v9 - with: - message: 'release: v${{ github.event.release.tag_name }}' - author_name: Medžuslovjansky Bot - author_email: noreply@interslavic.fun diff --git a/package.json b/package.json index 00789cd..c711b33 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,8 @@ "release": { "branches": [ "main" - ] + ], + "pkgRoot": "." }, "packageManager": "yarn@4.5.1" } diff --git a/packages/analysis/src/multireplacer/executors/RegExpExecutor.ts b/packages/analysis/src/multireplacer/executors/RegExpExecutor.ts index d87ae38..88ba4b0 100644 --- a/packages/analysis/src/multireplacer/executors/RegExpExecutor.ts +++ b/packages/analysis/src/multireplacer/executors/RegExpExecutor.ts @@ -6,13 +6,16 @@ import type { Executor } from './Executor'; type ReplacementValue = string | ((match: string, ...args: any[]) => string); export class RegExpExecutor implements Executor { + protected readonly sticky: RegExp; + protected readonly global: RegExp; + constructor( protected readonly regexp: RegExp, protected readonly replacements: Replacement[], - ) {} - - protected readonly sticky = this._cloneRegexp('y'); - protected readonly global = this._cloneRegexp('g'); + ) { + this.sticky = this._cloneRegexp('y'); + this.global = this._cloneRegexp('g'); + } execute(origin: Intermediate): Intermediate[] { const lastIndices = new Map(); diff --git a/packages/fs/src/repositories/serialization/MultilingualSynsetSerializer.ts b/packages/fs/src/repositories/serialization/MultilingualSynsetSerializer.ts index 23fb76e..85040f9 100644 --- a/packages/fs/src/repositories/serialization/MultilingualSynsetSerializer.ts +++ b/packages/fs/src/repositories/serialization/MultilingualSynsetSerializer.ts @@ -38,6 +38,10 @@ export class MultilingualSynsetSerializer extends XmlSerializer< }, prettier: { ...options.prettier, + plugins: [ + '@prettier/plugin-xml', + ...(options.prettier?.plugins ?? []), + ], parser: 'xml', }, });