File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed
Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ name : CI
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ pull_request :
8+ branches :
9+ - main
10+
11+ jobs :
12+ test :
13+ runs-on : ubuntu-latest
14+ strategy :
15+ matrix :
16+ node : [18, 20, 22] # Tester sur différentes versions de Node.js
17+ steps :
18+ - name : Checkout code
19+ uses : actions/checkout@v2 # Récupère ton code source
20+ - name : Set up Node.js
21+ uses : actions/setup-node@v2
22+ with :
23+ node-version : ${{ matrix.node }} # Utilise les versions de Node.js définies dans la stratégie
24+ - name : Install dependencies
25+ run : npm install # Installe les dépendances de ton projet
26+ - name : Run tests
27+ run : npm test # Exécute tes tests avec la commande npm test
28+
29+ release :
30+ if : github.ref == 'refs/heads/main' # Lancer cette étape uniquement si on pousse sur la branche 'main'
31+ runs-on : ubuntu-latest
32+ needs : [test] # Lancer après le job de test
33+ steps :
34+ - name : Checkout code
35+ uses : actions/checkout@v2
36+ - name : Set up Node.js
37+ uses : actions/setup-node@v2
38+ with :
39+ node-version : 20
40+ - name : Install dependencies
41+ run : npm install
42+ - name : Build the package
43+ run : npm run build # Si tu as une commande de build, sinon enlève cette étape
44+ - name : Publish to npm
45+ run : npm publish --access public # Publie ton package sur npm
46+ env :
47+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }} # Utilise un token npm secret pour l'authentification
You can’t perform that action at this time.
0 commit comments