-
-
Notifications
You must be signed in to change notification settings - Fork 60
138 lines (118 loc) · 3.66 KB
/
ci.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
name: CI
on:
push:
branches:
- 'main'
- 'v1'
pull_request:
paths-ignore:
- '.vscode/**'
# Automatically cancel in-progress actions on the same branch
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
# Lint can run in parallel with Build.
lint:
name: Lint
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18]
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
# Lint autofix cannot run on forks, so just skip those! See https://github.com/wearerequired/lint-action/issues/13
- name: Lint (External)
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.owner.login != github.repository_owner }}
run: pnpm run lint
# Otherwise, run lint autofixer
- name: Lint
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login == github.repository_owner }}
uses: wearerequired/lint-action@v1.10.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
prettier: true
auto_fix: true
git_name: github-actions[bot]
git_email: github-actions[bot]@users.noreply.github.com
commit_message: 'chore(lint): ${linter} fix'
github_token: ${{ secrets.GITHUB_TOKEN }}
neutral_check_on_warning: true
smoke:
name: 'Smoke Test: ${{ matrix.target }}'
runs-on: ubuntu-latest
strategy:
matrix:
target: [demo]
node-version: [18]
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
working-directory: ${{ matrix.target }}
# Changelog can only run _after_ Build and Test.
# We download all `dist/` artifacts from GitHub to skip the build process.
changelog:
name: Changelog PR or Release
needs: [lint, smoke]
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18]
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
- name: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1
with:
version: pnpm run version
commit: 'chore: release'
title: 'chore: release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}