Skip to content

Commit 0451b00

Browse files
committed
👷 Add github actions
1 parent d1fe8fd commit 0451b00

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

.github/workflows/ci.yml

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Run CI
2+
3+
# Run this workflow every time a new commit pushed to your repository
4+
on:
5+
push:
6+
branches:
7+
- maykin-4.13.12
8+
tags:
9+
- '*'
10+
pull_request:
11+
workflow_dispatch:
12+
13+
jobs:
14+
build:
15+
name: Create 'production' build
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
- uses: actions/setup-node@v3
21+
with:
22+
node-version-file: '.nvmrc'
23+
cache: npm
24+
25+
- name: Build
26+
run: |
27+
npm install
28+
npm run build
29+
30+
unit-tests:
31+
name: Run unit tests
32+
runs-on: ubuntu-latest
33+
needs: build
34+
35+
steps:
36+
- uses: actions/checkout@v3
37+
- uses: actions/setup-node@v3
38+
with:
39+
node-version-file: '.nvmrc'
40+
cache: npm
41+
42+
- name: Install dependencies
43+
run: npm install --include=dev
44+
45+
- name: Run unit tests
46+
run: |
47+
npm run test
48+
49+
publish:
50+
name: Publish the NPM package
51+
runs-on: ubuntu-latest
52+
needs:
53+
- build
54+
- unit-tests
55+
56+
# do not publish in forks or non-tag pushes
57+
if: startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'open-formulieren'
58+
59+
steps:
60+
- uses: actions/checkout@v3
61+
- uses: actions/setup-node@v3
62+
with:
63+
node-version-file: '.nvmrc'
64+
cache: npm
65+
registry-url: 'https://registry.npmjs.org'
66+
scope: '@open-formulieren'
67+
68+
- name: Build
69+
run: |
70+
- npm install
71+
- npm run build
72+
73+
- name: Publish package to NPM
74+
run: |
75+
- run: npm publish
76+
env:
77+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
78+

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
16

0 commit comments

Comments
 (0)