From 3707c0f7c47ff98dc7e22ed340836790608453cf Mon Sep 17 00:00:00 2001 From: George Rempousis Date: Sat, 9 Dec 2023 15:10:39 +0200 Subject: [PATCH] fix: testing CI --- .github/workflows/ci.yml | 9 +++---- .github/workflows/npm-publish.yml | 44 +++++++++++++------------------ .gitignore | 1 + .release-it.json | 30 +++++++++++++++++++++ package.json | 29 -------------------- 5 files changed, 52 insertions(+), 61 deletions(-) create mode 100644 .release-it.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ed3187..c7a5504 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,13 +9,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2 - with: - version: 8 - uses: actions/setup-node@v3 with: node-version: 18.x - - run: pnpm install --no-frozen-lockfile - - run: pnpm run tsc - - run: pnpm run test + - run: npm install + - run: npm run tsc -- --noEmit + - run: npm run test diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index f6590ce..7b1f8a9 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -1,9 +1,6 @@ -name: Release Workflow +name: Release & Publish ro NPM -on: - push: - branches: - - main +on: workflow_dispatch jobs: release: @@ -17,36 +14,31 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v3 with: - node-version: '18' # specify your Node.js version here + node-version: '18' # Installing dependencies - name: Install Dependencies - run: npm install + run: npm ci - # Building the project - - name: Build - run: npm build - - # Preparing package for release - - name: Prepare Package - run: cp package.json README.md pkg/ + # Initializing git config + - name: Initialize git user + run: | + git config --global user.email "george@altruistiq.com" + git config --global user.name "Release n Publish Workflow" - # Switching to 'releases' branch - - name: Switch to Releases Branch - run: git checkout releases + # Initializing the npm with the $NPM_TOKEN + - name: Initialize the NPM config + run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - # Cleaning and updating the branch - - name: Update Releases Branch - run: | - git rm -rf ./* - cp -R pkg/* . - git add . - git commit -m "auto-generate release $(git rev-parse --short HEAD)" - git push origin releases + # Building the project + - name: Build + run: npm tsc # Running release-it - name: Release to NPM - run: npm run release + run: npm run release -- --ci env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.gitignore b/.gitignore index d0ab101..b6b3de2 100644 --- a/.gitignore +++ b/.gitignore @@ -132,3 +132,4 @@ dist /pkg .idea .DS_Store +.npmrc diff --git a/.release-it.json b/.release-it.json new file mode 100644 index 0000000..e2cbd05 --- /dev/null +++ b/.release-it.json @@ -0,0 +1,30 @@ +{ + "git": { + "requireBranch": "main", + "commitMessage": "chore: release v${version}" + }, + "github": { + "release": true + }, + "npm": { + "publish": true + }, + "plugins": { + "@release-it/conventional-changelog": { + "infile": "CHANGELOG.md", + "preset": { + "name": "conventionalcommits", + "types": [ + { + "type": "feat", + "section": "Features" + }, + { + "type": "fix", + "section": "Bug Fixes" + } + ] + } + } + } +} diff --git a/package.json b/package.json index 0b7c29f..1b062e9 100644 --- a/package.json +++ b/package.json @@ -53,34 +53,5 @@ "express": "^4.18.2", "lodash": "^4.17.21", "reflect-metadata": "^0.1.13" - }, - "release-it": { - "git": { - "commitMessage": "chore: release v${version}" - }, - "github": { - "release": true - }, - "npm": { - "publish": true - }, - "plugins": { - "@release-it/conventional-changelog": { - "infile": "CHANGELOG.md", - "preset": { - "name": "conventionalcommits", - "types": [ - { - "type": "feat", - "section": "Features" - }, - { - "type": "fix", - "section": "Bug Fixes" - } - ] - } - } - } } }