From 6909fc255bfc665f82b8e7331e0af190d31ce51e Mon Sep 17 00:00:00 2001 From: Alexey Ryazanov Date: Mon, 10 Jul 2023 07:54:09 +0500 Subject: [PATCH] ci: minor changes in pull-request workflow --- .github/workflows/build.yml | 48 ----------------------- .github/workflows/pull-request.yml | 63 ++++++++++++++++++++++++++++++ .github/workflows/release.yml | 44 +++++++++++++++++++++ 3 files changed, 107 insertions(+), 48 deletions(-) delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/pull-request.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 221e2e1..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: CI - -# Controls when the action will run. Triggers the workflow on push or pull request -# events but only for the master branch -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - runs-on: ubuntu-latest - - strategy: - matrix: - node: [ 8, 10, 12, 14, 16, 18, 20 ] - - steps: - - uses: actions/checkout@v3 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node }} - - - name: Install dependencies - run: npm install - - run: npm run build - - run: npm run test:ci - - - name: Coveralls GitHub Action - uses: coverallsapp/github-action@master - env: - COVERALLS_FLAG_NAME: run-${{ matrix.node-version }} - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - parallel: true - - finish: - needs: build - runs-on: ubuntu-latest - steps: - - name: Coveralls Finished - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - parallel-finished: true diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 0000000..da93b48 --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,63 @@ +name: pull-request + +run-name: Run CI for ${{ github.head_ref }} + +on: + pull_request: + branches: + - master + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + +jobs: + run: + runs-on: ubuntu-latest + + strategy: + matrix: + node: [ 8, 10, 12, 14, 16, 18, 20 ] + + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.head_ref }} + + - name: Use Node.js ${{ matrix.node }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node }} + registry-url: 'https://registry.npmjs.org' + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build + + - name: Test + run: npm run test:ci + + - name: Coveralls + uses: coverallsapp/github-action@master + env: + COVERALLS_FLAG_NAME: run-${{ matrix.node }} + with: + # https://github.com/orgs/community/discussions/25191#discussioncomment-3246770 + git-commit: ${{ github.event.pull_request.head.sha }} + git-branch: ${{ github.head_ref }} + parallel: true + + coveralls-finalize: + needs: run + runs-on: ubuntu-latest + steps: + - name: Coveralls finalize + uses: coverallsapp/github-action@master + with: + # https://github.com/orgs/community/discussions/25191#discussioncomment-3246770 + git-commit: ${{ github.event.pull_request.head.sha }} + git-branch: ${{ github.head_ref }} + parallel-finished: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..8e2d3e7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,44 @@ +name: Release + +on: + push: + branches: + - master + +jobs: + release: + if: "!contains(github.event.head_commit.message, 'chore(release)')" + + runs-on: ubuntu-latest + + steps: + - run: echo 'Test' +# - uses: actions/checkout@v2 +# with: +# token: ${{ secrets.TINKOFF_BOT_PAT }} +# fetch-depth: 0 +# +# - name: Git Identity +# run: | +# git config --global user.name 'tinkoff-bot' +# git config --global user.email 'tinkoff-bot@users.noreply.github.com' +# +# - uses: actions/setup-node@v2 +# with: +# node-version: '14.x' +# registry-url: 'https://registry.npmjs.org' +# +# - name: Clean install +# run: npm ci +# +# - name: Create release commit and tag +# run: | +# npm run version -- --no-push +# +# - name: Push release commit and tag +# run: git push --follow-tags +# +# - name: Publish packages +# run: npm run publish:ci +# env: +# NODE_AUTH_TOKEN: ${{ secrets.TINKOFF_NPM_AUTH_TOKEN }}