-
Notifications
You must be signed in to change notification settings - Fork 0
149 lines (142 loc) · 4.25 KB
/
checks.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Checks
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
checks: write
pull-requests: write
jobs:
lint:
if: |
!startsWith(github.event.head_commit.message, 'chore: release v')
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: "npm"
node-version: 20.10.0
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint:ci
- uses: enricomi/publish-unit-test-result-action@v2
if: always()
with:
check_name: Lint results
fail_on: errors
files: reports/lint-results.xml
test:
name: Test
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: "npm"
node-version: 20.10.0
- name: Install dependencies
run: npm ci && node ./node_modules/puppeteer/install.mjs
- name: Test
run: npm run test:ci
- uses: enricomi/publish-unit-test-result-action@v2
if: always()
with:
check_name: Test results
fail_on: errors
files: reports/test-results.xml
build:
name: Build
needs: [lint, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: "npm"
node-version: 20.10.0
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Docs
if: github.event_name == 'pull_request'
run: npm run generate:docs
- name: Upload
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v3
with:
name: preview
path: dist
deploy-pr:
if: github.event_name == 'pull_request'
name: Deploy PR
needs: build
runs-on: ubuntu-latest
environment:
name: Review
url: https://webcomponents-preview.github.io/client/pr/${{ github.event.number }}/
steps:
- uses: actions/checkout@v3
with:
ref: deploy
token: ${{secrets.WCP_GITHUB_TOKEN}}
- uses: actions/download-artifact@v3
with:
name: preview
path: .tmp
- name: Configure git
run: |
git config user.name "autoreleaser"
git config user.email "release@enke.dev"
- name: Update latest
run: |
rm -rf pr/${{ github.event.number }}
mkdir -p pr
mv .tmp pr/${{ github.event.number }}
git add .
git commit --allow-empty --message $GITHUB_SHA
git push
release:
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
name: Release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{secrets.WCP_GITHUB_TOKEN}}
- uses: actions/setup-node@v3
with:
cache: "npm"
node-version: 20.10.0
registry-url: https://registry.npmjs.org/
- name: Configure git
run: |
git config user.name "autoreleaser"
git config user.email "release@enke.dev"
- name: Configure npm
run: npm config set //registry.npmjs.org/:_authToken ${{secrets.WCP_NPM_TOKEN}}
- name: Release
run: |
npx --package release-it --package @release-it/conventional-changelog release-it \
--ci \
--npm.skipChecks \
--no-npm.publish \
--github.release \
--github.autoGenerate \
--git.commitMessage='chore: release v${version}' \
--git.pushArgs=--follow-tags \
--plugins.@release-it/conventional-changelog.infile=CHANGELOG.md \
--plugins.@release-it/conventional-changelog.header='# <img align="left" src="https://github.com/webcomponents-preview/client/raw/main/src/assets/icons/logo.svg" alt="WCP Logo" height="43px"> Web Components Preview' \
--plugins.@release-it/conventional-changelog.preset=angular
env:
GITHUB_TOKEN: ${{secrets.WCP_GITHUB_TOKEN}}
NODE_AUTH_TOKEN: ${{secrets.WCP_NPM_TOKEN}}