From cf864682f2c7d64d8eabd72b883c21da77e942b6 Mon Sep 17 00:00:00 2001 From: Matthew Crenshaw Date: Mon, 25 Apr 2022 13:58:10 -0400 Subject: [PATCH] ci(workflows): improve release action, update outdated actions --- .github/workflows/codeql-analysis.yml | 14 ++-- .github/workflows/node.js.yml | 100 -------------------------- .github/workflows/release.yml | 23 ++++++ .github/workflows/stale.yml | 16 ++--- .github/workflows/test.yml | 54 ++++++++++++++ .releaserc.json | 30 +++++--- package-lock.json | 3 + package.json | 9 ++- 8 files changed, 121 insertions(+), 128 deletions(-) delete mode 100644 .github/workflows/node.js.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 34d8455..2f73b7c 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -3,7 +3,7 @@ # # You may wish to alter this file to override the set of languages analyzed, # or to provide custom queries or build logic. -name: "CodeQL" +name: 'CodeQL' on: push: @@ -12,7 +12,7 @@ on: # The branches below must be a subset of the branches above branches: [master] schedule: - - cron: "0 5 * * 2" + - cron: '0 5 * * 2' jobs: analyze: @@ -24,17 +24,17 @@ jobs: matrix: # Override automatic language detection by changing the below list # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] - language: ["javascript"] + language: ['javascript'] # Learn more... # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v2 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -45,7 +45,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v1 + uses: github/codeql-action/autobuild@v2 # โ„น๏ธ Command-line programs to run using the OS shell. # ๐Ÿ“š https://git.io/JvXDl @@ -59,4 +59,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml deleted file mode 100644 index ada4a69..0000000 --- a/.github/workflows/node.js.yml +++ /dev/null @@ -1,100 +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, develop] - -jobs: - # building job - build: - runs-on: ubuntu-latest - name: Build - - strategy: - matrix: - node-version: [12.x, 14.x, 16.x, 17.x] - - steps: - - uses: actions/checkout@v2 - - name: Building on Node.js ${{ matrix.node-version }} ๐Ÿ› ๏ธ - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - run: npm install -g npm@7 # update to npm 7 - - run: npm ci # equivalent of npm ci - - run: npm run build - - # testing job - test: - runs-on: ubuntu-latest - name: Test - - strategy: - matrix: - node-version: [12.x, 14.x, 16.x, 17.x] - steps: - - uses: actions/checkout@v2 - - name: Testing on node ${{ matrix.node-version }} ๐Ÿงช - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - run: npm install -g npm@7 # update to npm 7 - - run: npm ci - - run: npm run lint - - run: npm test - - # coverage uploading job - coverage: - runs-on: ubuntu-latest - name: Coverage - needs: Test - - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - with: - # latest nodejs LTS - node-version: 16.x - - run: npm ci - - run: npm run lint - - run: npm test - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1 - with: - token: ${{ secrets.CODECOV_TOKEN }} - directory: ./coverage - - # release to npm job - release: - runs-on: ubuntu-latest - name: Release - needs: Test - - # release only when pushed to master - if: github.event_name == 'push' - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - - uses: actions/checkout@v2 - with: - token: ${{ secrets.GIT_ACCESS_TOKEN }} - - uses: actions/setup-node@v1 - with: - # latest nodejs LTS - node-version: 16.x - - run: npm ci - - name: Preparing a release for npm and github ๐Ÿš€ - # more about this action here: https://github.com/cycjimmy/semantic-release-action - uses: cycjimmy/semantic-release-action@v2 - with: - extra_plugins: | - @semantic-release/changelog - @semantic-release/git - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ef83e29 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,23 @@ +name: Release +'on': + push: + branches: + - master + - next + - beta + - '*.x' +jobs: + release: + name: release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + cache: npm + node-version: 16 + - run: npm ci + - run: npx semantic-release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 3404517..e04f391 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -2,18 +2,14 @@ name: Mark stale issues and pull requests on: schedule: - - cron: "30 1 * * *" + - cron: '30 1 * * *' jobs: stale: - runs-on: ubuntu-latest - steps: - - uses: actions/stale@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: 'Stale issue message' - stale-pr-message: 'Stale pull request message' - stale-issue-label: 'no-issue-activity' - stale-pr-label: 'no-pr-activity' + - uses: actions/stale@v4 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-label: 'no-issue-activity' + stale-pr-label: 'no-pr-activity' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..a45c4e2 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,54 @@ +name: Test +'on': + push: + branches: + - master + - renovate/** + pull_request: + types: + - opened + - synchronize +jobs: + test_matrix: + strategy: + matrix: + node-version: [12, 14, 16, 17] + os: + - ubuntu-latest + runs-on: '${{ matrix.os }}' + steps: + - uses: actions/checkout@v3 + - name: 'Use Node.js ${{ matrix.node-version }}' + uses: actions/setup-node@v3 + with: + node-version: '${{ matrix.node-version }}' + cache: npm + - run: npm ci + - run: npm run test + coverage: + runs-on: ubuntu-latest + needs: test_matrix + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + cache: npm + - run: npm ci + - run: npm run lint + - run: npm run test + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v2 + with: + directory: ./coverage + build: + runs-on: ubuntu-latest + needs: test_matrix + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + cache: npm + - run: npm ci + - run: npm run build diff --git a/.releaserc.json b/.releaserc.json index 14c3269..1fe6875 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -1,11 +1,15 @@ { - "branches": [ "master", "next", "next-major", "build", + "branches": [ + "master", + "next", + "next-major", + "build", { - "name": "beta", + "name": "beta", "prerelease": true - }, + }, { - "name": "alpha", + "name": "alpha", "prerelease": true } ], @@ -13,8 +17,18 @@ "@semantic-release/commit-analyzer", "@semantic-release/release-notes-generator", "@semantic-release/changelog", - "@semantic-release/github", - "@semantic-release/npm", - "@semantic-release/git" + [ + "@semantic-release/npm", + { + "tarballDir": "dist" + } + ], + "@semantic-release/git", + [ + "@semantic-release/github", + { + "assets": "dist/*.tgz" + } ] -} \ No newline at end of file + ] +} diff --git a/package-lock.json b/package-lock.json index a39968f..1335d67 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,10 @@ "@rollup/plugin-babel": "^5.3.1", "@rollup/plugin-node-resolve": "^13.2.1", "@semantic-release/changelog": "^6.0.1", + "@semantic-release/commit-analyzer": "^9.0.2", "@semantic-release/git": "^10.0.1", + "@semantic-release/github": "^8.0.4", + "@semantic-release/release-notes-generator": "^10.0.3", "@tsconfig/node12": "^1.0.9", "@types/jest": "^27.4.1", "@typescript-eslint/eslint-plugin": "^5.20.0", diff --git a/package.json b/package.json index 7bc92fe..58a9d28 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,9 @@ { "name": "adhan", - "version": "4.3.2", "description": "High precision Islamic prayer time library", + "version": "4.3.2", + "author": "Ameir Al-Zoubi ", + "license": "MIT", "main": "lib/cjs/Adhan.js", "module": "lib/esm/Adhan.js", "types": "lib/types/Adhan.d.ts", @@ -40,8 +42,6 @@ "salaat", "namaz" ], - "author": "Ameir Al-Zoubi ", - "license": "MIT", "devDependencies": { "@babel/cli": "^7.17.6", "@babel/core": "^7.17.9", @@ -52,7 +52,10 @@ "@rollup/plugin-babel": "^5.3.1", "@rollup/plugin-node-resolve": "^13.2.1", "@semantic-release/changelog": "^6.0.1", + "@semantic-release/commit-analyzer": "^9.0.2", "@semantic-release/git": "^10.0.1", + "@semantic-release/github": "^8.0.4", + "@semantic-release/release-notes-generator": "^10.0.3", "@tsconfig/node12": "^1.0.9", "@types/jest": "^27.4.1", "@typescript-eslint/eslint-plugin": "^5.20.0",