-
Notifications
You must be signed in to change notification settings - Fork 2
116 lines (107 loc) · 4.04 KB
/
main.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
108
109
110
111
112
113
114
115
116
name: main
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Need all tags to get a version number in-between tags
- uses: actions/setup-node@v3
with:
cache: 'yarn'
- run: yarn --frozen-lockfile
- run: yarn build-demo
- run: yarn build-natural # Build natural again, because when building natural-editor ngcc was used on natural
- uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: 'yarn'
- run: yarn --frozen-lockfile
- run: ./node_modules/.bin/ng test natural --progress false --watch=false --browsers ChromeHeadlessCustom
- run: ./node_modules/.bin/ng test natural-editor --progress false --watch=false --browsers ChromeHeadlessCustom
- run: ./node_modules/.bin/ng test demo --progress false --watch=false --browsers ChromeHeadlessCustom
# - run: yarn e2e
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: 'yarn'
- run: yarn --frozen-lockfile
- run: yarn lint
prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: 'yarn'
- run: yarn --frozen-lockfile
- run: ./node_modules/.bin/prettier --check .
publish-demo:
runs-on: ubuntu-latest
needs:
- build
- test
steps:
- uses: actions/download-artifact@v3
with:
name: dist
path: dist/
- uses: crazy-max/ghaction-github-pages@v3
with:
build_dir: dist/demo
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release:
runs-on: ubuntu-latest
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
needs:
- build
- test
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.ref }} # Otherwise our annotated tag is not fetched and we cannot get correct version
- uses: actions/download-artifact@v3
with:
name: dist
path: dist/
- run: rm .gitignore
# Publish to npm
- uses: actions/setup-node@v3
with:
registry-url: 'https://registry.npmjs.org'
- run: npm publish --access public dist/natural/
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: npm publish --access public dist/natural-editor/
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# Publish to GitHub Packages
- uses: actions/setup-node@v3
with:
registry-url: 'https://npm.pkg.github.com'
- run: npm publish --access public dist/natural/
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: npm publish --access public dist/natural-editor/
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Create release
- name: Get release info
run: git tag --format '%(contents:body)' --points-at > release-body.txt
- uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
bodyFile: release-body.txt