-
Notifications
You must be signed in to change notification settings - Fork 1
70 lines (70 loc) · 2.06 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
on: push
name: Build Angular Application
permissions:
contents: read
issues: read
checks: write
pull-requests: write
jobs:
build:
if: github.ref != 'refs/heads/master'
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 20.x]
steps:
- uses: actions/checkout@v3
- name: Cache node modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: npm install and npm run build
run: |
npm i
npm run build
npm test
# npm run lint
- name: Push Build to Releases
if: startsWith(github.ref, 'refs/tags/v')
uses: ncipollo/release-action@v1
with:
artifacts: "dist/angular-githubaction/*"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
junit_files: test-results/*.xml
deploy-ghpages:
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache node modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Node ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: npm install and npm run build
run: |
npm i
npm run deploy
- name: Deploy to GH pages
if: startsWith(github.ref, 'refs/tags/v')
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: dist # The folder the action should deploy.