Repository navigation
119 lines (112 loc) · 3.93 KB
/
Copy pathci-cd.yml
File metadata and controls
119 lines (112 loc) · 3.93 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
name: CI/CD
on:
pull_request:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: write # Required for release-it to create tags and GitHub releases
jobs:
commitlint:
name: Lint commits
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Lint commits
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
react-18:
name: Build and test with React 18
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Install dependencies with React 18
run: |
for workspace in @linagora/twake-css @linagora/twake-icons @linagora/twake-mui; do
npm pkg set devDependencies.react=^18.3.1 devDependencies.react-dom=^18.3.1 devDependencies.@types/react=^18.3.0 --workspace=$workspace
done
npm pkg set devDependencies.@types/react-dom=^18.3.0 --workspace=@linagora/twake-mui
# Drop the locked React 19 so that npm resolves React 18 everywhere
node -e "
const fs = require('fs')
const lock = JSON.parse(fs.readFileSync('package-lock.json'))
for (const key of Object.keys(lock.packages)) {
if (/node_modules\/(react|react-dom|@types\/react|@types\/react-dom|scheduler)$/.test(key)) delete lock.packages[key]
}
fs.writeFileSync('package-lock.json', JSON.stringify(lock, null, 2))
"
npm install
npm ls react react-dom @types/react
- name: Build twake-icons (for type resolution)
run: npm run build --workspace=@linagora/twake-css --workspace=@linagora/twake-icons
- name: Lint
run: npm run lint
- name: Build
run: npm run build
- name: Test
run: npm test --workspace=@linagora/twake-mui
build:
name: Build and publish
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0 # Full git history required for release-it (changelog, tags, commits analysis)
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build twake-icons (for type resolution)
run: npm run build --workspace=@linagora/twake-css --workspace=@linagora/twake-icons
- name: Lint
run: npm run lint
- name: Check formatting
run: npm run lint:fmt
- name: Check barrel export
run: npm run check:barrel --workspace=@linagora/twake-icons
- name: Build
run: npm run build
- name: Test
run: npm test --workspace=@linagora/twake-mui
- name: Configure git
if: github.ref == 'refs/heads/main'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Release
if: github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_IN_VAULT }}
run: npm run release