-
Notifications
You must be signed in to change notification settings - Fork 1
85 lines (82 loc) · 2.3 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
name: CI
on:
pull_request:
types: [opened, synchronize]
push:
branches: [main]
concurrency:
group: "${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }}"
cancel-in-progress: true
jobs:
format:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Use node
uses: actions/setup-node@v3
with:
node-version: 20
cache: npm
- name: Install dependencies
run: npm ci
- name: Format Code
run: npm run format
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "[ci] format"
commit_user_name: "github-actions[bot]"
commit_user_email: "github-actions[bot]@users.noreply.github.com"
test:
runs-on: ubuntu-latest
name: "test: node@${{ matrix.node }}"
strategy:
fail-fast: false
matrix:
node: [20]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Use node@${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: npm
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium
- name: Run tests
run: npm run @ci:test
- name: Report code coverage
uses: codecov/codecov-action@v3
release:
runs-on: ubuntu-latest
needs: [format, test]
if: "${{ github.repository_owner == 'marko-js' && github.event_name == 'push' }}"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 20
cache: npm
- name: Install dependencies
run: npm ci
- name: Release
id: changesets
uses: changesets/action@v1
with:
version: npm run version
publish: npm run release
commit: "[ci] release"
title: "[ci] release"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}