Merge pull request #512 from sebbo2002/template-updater/update #714
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test & Release | |
on: | |
push: | |
branches-ignore: | |
- 'gh-pages' | |
- 'depfu/**' | |
- 'dependabot/**' | |
- 'template-updater/**' | |
pull_request: null | |
jobs: | |
tests: | |
name: Unit Tests | |
runs-on: ubuntu-latest | |
if: github.repository != 'sebbo2002/js-template' && (contains(toJson(github.event.commits.*.message), '[skip ci]') == false || github.ref == 'refs/heads/main') | |
strategy: | |
matrix: | |
node: [16.x, 18.x, 20.x] | |
steps: | |
- name: ☁️ Checkout Project | |
uses: actions/checkout@v3 | |
- name: 🔧 Setup node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: 'npm' | |
- name: 🔧 Upgrade npm | |
run: npm install -g npm@latest | |
- name: 📦 Install dependencies | |
run: npm ci | |
- name: ⏳ Run tests | |
run: npm run test | |
coverage: | |
name: Code Coverage / Lint | |
runs-on: ubuntu-latest | |
if: github.repository != 'sebbo2002/js-template' && (contains(toJson(github.event.commits.*.message), '[skip ci]') == false || github.ref == 'refs/heads/main') | |
steps: | |
- name: ☁️ Checkout Project | |
uses: actions/checkout@v3 | |
- name: 🔧 Setup node.js | |
uses: actions/setup-node@v3 | |
with: | |
cache: 'npm' | |
- name: 📦 Install dependencies | |
run: npm ci | |
- name: 🔍 Run linter | |
run: npm run lint | |
- name: ⚙️ Build project | |
run: npm run build-all | |
license-checker: | |
name: License Checker | |
runs-on: ubuntu-latest | |
if: contains(toJson(github.event.commits.*.message), '[skip ci]') == false || github.ref == 'refs/heads/main' | |
steps: | |
- name: ☁️ Checkout Project | |
uses: actions/checkout@v3 | |
- name: 🔧 Setup node.js | |
uses: actions/setup-node@v3 | |
with: | |
cache: 'npm' | |
- name: 📦 Install dependencies | |
run: npm ci | |
- name: 🕵️♀️ Run license checker | |
run: npm run license-check | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
concurrency: release | |
needs: | |
- coverage | |
- tests | |
- license-checker | |
if: ${{ github.repository != 'sebbo2002/js-template' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop') }} | |
steps: | |
- name: ☁️ Checkout Project | |
uses: actions/checkout@v3 | |
- name: 🔧 Setup node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20.x | |
cache: 'npm' | |
- name: 📦 Install dependencies | |
run: npm ci | |
- name: 📂 Create docs folder | |
run: mkdir ./docs | |
- name: 🪄 Run semantic-release | |
run: BRANCH=${GITHUB_REF#refs/heads/} npx semantic-release | |
env: | |
GH_REPO: ${{ github.repository }} | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
GH_OWNER: ${{ github.repository_owner }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: 🔃 Merge main back into develop | |
if: ${{ github.ref == 'refs/heads/main' }} | |
uses: everlytic/[email protected] | |
with: | |
github_token: ${{ secrets.GH_TOKEN }} | |
source_ref: 'main' | |
target_branch: 'develop' | |
commit_message_template: 'Merge branch {source_ref} into {target_branch} [skip ci]' |