-
Notifications
You must be signed in to change notification settings - Fork 33
120 lines (101 loc) · 3.33 KB
/
release.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
name: CI
on:
push:
branches: [main, next]
pull_request:
branches: [main, next]
schedule:
# Tuesdays at 14:45 UTC (10:45 EST)
- cron: 45 14 * * 1
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
main:
# ignore all-contributors PRs
if: ${{ !contains(github.head_ref, 'all-contributors') }}
name: Node ${{ matrix.node }}, Svelte ${{ matrix.svelte }}, ${{ matrix.check }}
runs-on: ubuntu-latest
# enable OIDC for codecov uploads
permissions:
id-token: write
strategy:
fail-fast: false
matrix:
node: ['16', '18', '20']
svelte: ['3', '4']
check: ['test:vitest:jsdom', 'test:vitest:happy-dom', 'test:jest']
include:
# We only need to lint once, so do it on latest Node and Svelte
- { node: '20', svelte: '4', check: 'lint' }
# `SvelteComponent` is not generic in Svelte 3, so type-checking only passes in >= 4
- { node: '20', svelte: '4', check: 'types' }
- { node: '20', svelte: 'next', check: 'types' }
# Only run Svelte 5 checks on latest Node
- { node: '20', svelte: 'next', check: 'test:vitest:jsdom' }
- { node: '20', svelte: 'next', check: 'test:vitest:happy-dom' }
- { node: '20', svelte: 'next', check: 'test:jest' }
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- name: ⎔ Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: 📥 Download deps
run: |
npm install --no-package-lock
npm install --no-save svelte@${{ matrix.svelte }}
- name: ▶️ Run ${{ matrix.check }}
run: npm run ${{ matrix.check }}
- name: ⬆️ Upload coverage report
if: ${{ startsWith(matrix.check, 'test:') }}
uses: codecov/codecov-action@v4
with:
use_oidc: true
fail_ci_if_error: true
build:
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- name: ⎔ Setup node
uses: actions/setup-node@v4
with:
node-version: 20
- name: 📥 Download deps
run: npm install --no-package-lock
- name: 🏗️ Build types
run: npm run build
- name: ⬆️ Upload types build
uses: actions/upload-artifact@v4
with:
name: types
path: types
release:
needs: [main, build]
runs-on: ubuntu-latest
if: ${{ github.repository == 'testing-library/svelte-testing-library' &&
contains('refs/heads/main,refs/heads/next', github.ref) &&
github.event_name == 'push' }}
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- name: ⎔ Setup node
uses: actions/setup-node@v4
with:
node-version: 20
- name: 📥 Downloads types build
uses: actions/download-artifact@v4
with:
name: types
path: types
- name: 🚀 Release
uses: cycjimmy/semantic-release-action@v4
with:
semantic_version: 24
extra_plugins: |
conventional-changelog-conventionalcommits@8
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}