-
Notifications
You must be signed in to change notification settings - Fork 8
133 lines (128 loc) · 4.57 KB
/
main.yaml
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Build, Test & Deploy demo
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
# push:
# branches: [master]
pull_request:
branches: [master]
types: [opened, synchronize, reopened]
# release:
# types: [published]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
runs-on: ubuntu-latest
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# strategy:
# matrix:
# node-version: [12.x, 14.x]
steps:
- name: Echo step
if: ${{ github.event_name == 'pull_request' && github.event.action == 'opened' }}
run: echo This event is a pull request that was opened.
#
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
#
- name: Build on Node.js # ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
# node-version: ${{ matrix.node-version }}
node-version: 18
#
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
#
- name: Install
run: npm ci
- name: Lint & Test
# This line is needed for nx affected to work when CI is running on a PR
uses: nrwl/nx-set-shas@v3
- run: git branch --track master origin/master
- run: npm run lint:all && npm run test
env:
CI: true
# Save coverage report in Coveralls
- name: Coveralls
if: ${{ success() }}
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# env:
# COVERALLS_SERVICE_NAME: '@ngx-odm'
# COVERALLS_PARALLEL: true
# Build if release published
- name: Build
# if: github.event.release.published
run: npm run build
- name: Archive production artifacts
uses: actions/upload-artifact@v2
with:
name: dist-packages
path:
dist/packages
# !dist/**/*.md
# Build if release published
- name: Build Demo
# if: github.event.release.published
run: npm run build:demo && npm run compodoc
###
- name: Upload demo artifact
uses: actions/upload-pages-artifact@v2
with:
path: 'dist/demo'
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v2 # or the latest "vX.X.X" version tag for this action
with:
token: ${{ secrets.GITHUB_TOKEN }}
preview: false
# publish:
# if: github.event.pull_request.merged || github.event.release.published
# needs: build
# runs-on: ubuntu-latest
# steps:
# # - uses: actions/checkout@v2
# # - name: Download all workflow run artifacts
# # - uses: actions/cache@v2
# - uses: actions/download-artifact@v2
# - name: Version and publish
# run: |
# git config user.name $GITHUB_ACTOR
# git config user.email gh-actions-${GITHUB_ACTOR}@github.com
# git remote add gh-origin https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
# npm version minor --force -m "v%s" -m "build(*): release new version [build-skip]"
# git push gh-origin HEAD:master --tags
# - uses: actions/setup-node@v2
# with:
# node-version: 18
# registry-url: 'https://registry.npmjs.org'
# - run: |
# npm run packages:publish:dev
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# - uses: actions/setup-node@v2
# with:
# registry-url: 'https://npm.pkg.github.com'
# - run: |
# npm run packages:publish:dev
# env:
# NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow#about-the-github_token-secret