From 9c43702cae918c35b951d2daad00ae4a26796b0c Mon Sep 17 00:00:00 2001 From: Damian Osipiuk Date: Fri, 11 Jun 2021 00:09:08 +0200 Subject: [PATCH] chore: update workflows --- .github/FUNDING.yml | 1 + .github/workflows/ci.yml | 59 ++++++++++++++++++++++++++++++++ .github/workflows/nodejs.yml | 31 ----------------- .github/workflows/npmpublish.yml | 43 ----------------------- package.json | 3 +- 5 files changed, 61 insertions(+), 76 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/nodejs.yml delete mode 100644 .github/workflows/npmpublish.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index ede46d5..2b32bd6 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1,2 @@ +github: DamianOsipiuk custom: paypal.me/DamianOsipiuk diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..296f1f7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,59 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + +jobs: + commitlint: + runs-on: ubuntu-latest + + name: "Lint commit message" + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: wagoid/commitlint-github-action@v3 + + verify: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [10, 12, 14, 16] + + name: "Verify (Node ${{ matrix.node-version }})" + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - run: npm ci + - run: npm run lint + - run: npm run build + - run: npm test + env: + CI: true + + publish: + # publish only when merged in master on original repo, not on PR + if: github.repository == 'DamianOsipiuk/testrail-js-api' && github.ref == 'refs/heads/main' + needs: [verify, commitlint] + runs-on: ubuntu-latest + + name: "Publish to NPM" + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 14 + registry-url: https://registry.npmjs.org/ + - run: npm ci + - run: npm run build + - run: npx semantic-release@17 --branches main + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}} + GH_TOKEN: ${{secrets.GITHUB_TOKEN}} \ No newline at end of file diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml deleted file mode 100644 index 1c4a980..0000000 --- a/.github/workflows/nodejs.yml +++ /dev/null @@ -1,31 +0,0 @@ -# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - -name: Node.js CI - -on: - push: - branches: [master] - pull_request: - branches: [master] - -jobs: - build: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [10.x, 12.x] - - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - run: npm ci - - run: npm run lint - - run: npm run build --if-present - - run: npm test - env: - CI: true diff --git a/.github/workflows/npmpublish.yml b/.github/workflows/npmpublish.yml deleted file mode 100644 index 4773db3..0000000 --- a/.github/workflows/npmpublish.yml +++ /dev/null @@ -1,43 +0,0 @@ -# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created -# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages - -name: Node.js Package - -on: - release: - types: [created] - -jobs: - build: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [10.x, 12.x] - - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - run: npm ci - - run: npm run lint - - run: npm run build --if-present - - run: npm test - env: - CI: true - - publish-npm: - needs: build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - with: - node-version: 12 - registry-url: https://registry.npmjs.org/ - - run: npm ci - - run: npm publish - env: - NODE_AUTH_TOKEN: ${{secrets.npm_token}} diff --git a/package.json b/package.json index 94c2101..aa7a6d6 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,7 @@ }, "scripts": { "build": "tsc", - "lint": "eslint ./src/** ./tests/**", - "prepare": "npm run build", + "lint": "eslint tests --ext .js,.ts", "test": "jest" }, "repository": {