Merge pull request #589 from sebbo2002/depfu/batch_dev/npm/2024-03-26 #889
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: [18.x, 20.x, current] | |
steps: | |
- name: ☁️ Checkout Project | |
uses: actions/checkout@v4 | |
- name: 🔧 Setup node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: 'npm' | |
- 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@v4 | |
- name: 🔧 Setup node.js | |
uses: actions/setup-node@v4 | |
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@v4 | |
- name: 🔧 Setup node.js | |
uses: actions/setup-node@v4 | |
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 | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
id-token: write | |
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@v4 | |
- name: 🔧 Setup node.js | |
uses: actions/setup-node@v4 | |
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 }} | |
NPM_CONFIG_PROVENANCE: true | |
- 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]' |