-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (103 loc) · 3.4 KB
/
test-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
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, 21.x]
steps:
- name: ☁️ Checkout Project
uses: actions/checkout@v4
- name: 🔧 Setup node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- name: 📦 Install dependencies
run: npm ci
- name: 🐳 Pull alpine image (for unit tests)
run: docker pull alpine
- 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@v3
with:
cache: 'npm'
- name: 📦 Install dependencies
run: npm ci
- name: 🐳 Pull alpine image (for unit tests)
run: docker pull alpine
- 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@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@v4
- 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: 🐳 Pull alpine image (for unit tests)
run: docker pull alpine
- 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]'