-
-
Notifications
You must be signed in to change notification settings - Fork 9
172 lines (165 loc) · 5.03 KB
/
cicd.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: CI/CD
on:
push:
branches:
- main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check_format:
name: Check format
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup
uses: ./.github/actions/setup
- name: Check format
run: pnpm lint
env:
CI: true
check_type:
name: Check type
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup
uses: ./.github/actions/setup
- name: Check type
run: pnpm typecheck
env:
CI: true
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: read
needs:
- check_format
- check_type
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup
uses: ./.github/actions/setup
- name: Build
run: pnpm build
env:
CI: true
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: dist
path: dist
unit_test:
name: Unit Test on node ${{ matrix.node-version }}
needs:
- check_format
- check_type
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x, 20.x, 22.x]
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup
uses: ./.github/actions/setup
- name: Test
run: pnpm test
env:
CI: true
integration_test:
name: Integration Test on TypeDoc ${{ matrix.typedoc-version }}
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: False
matrix:
typedoc-version:
- '^0.23.x'
- '^0.24.x'
- '^0.25.x'
- '^0.26.x'
needs:
- build
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup
uses: ./.github/actions/setup
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
- name: TypeDoc integration test
working-directory: example
run: |
pnpm add -D typedoc@${{ matrix.typedoc-version }}
pnpm doc
release:
name: Release
runs-on: ubuntu-latest
needs:
- build
- unit_test
- integration_test
# if repository is github.com/kamiazya/typedoc-plugin-mermaid
# and branch is main
# and before job is successful
# then run this job
if: ${{ github.repository == 'kamiazya/typedoc-plugin-mermaid' && github.ref == 'refs/heads/main' && github.event_name == 'push' && success() }}
permissions:
contents: write # Used to commit to "Version Packages" PR
pull-requests: write # Used to create "Version Packages" PR
id-token: write # Used to publish to npm with provenance statements
# Other permissions are defaulted to none
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup
uses: ./.github/actions/setup
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@aba318e9165b45b7948c60273e0b72fce0a64eb9 # v1.4.7
with:
publish: pnpm exec changeset publish
version: pnpm exec changeset version
createGithubReleases: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
outputs:
published: ${{ steps.changesets.outputs.published }}
prerelease:
name: Prerelease
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
needs: release
# if repository is github.com/kamiazya/typedoc-plugin-mermaid
# and branch is main
# and release job dosen't publish package to npm
# then run this job
if: ${{ github.repository == 'kamiazya/typedoc-plugin-mermaid' && github.ref == 'refs/heads/main' && github.event_name == 'push' && needs.release.outputs.published == 'false' }}
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup
uses: ./.github/actions/setup
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
- name: Snapshot Release @next
uses: ./.github/actions/snapshot-release
with:
tag: next
name: next
github-token: ${{ secrets.GITHUB_TOKEN }}
npm-token: ${{ secrets.NODE_AUTH_TOKEN }}