-
Notifications
You must be signed in to change notification settings - Fork 1
99 lines (79 loc) · 2.89 KB
/
ci.yml
File metadata and controls
99 lines (79 loc) · 2.89 KB
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
name: CI
on:
push:
branches: [main]
pull_request:
pull_request_target:
types: [opened, edited, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
quality:
name: Quality checks
if: github.event_name != 'pull_request_target'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.22
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build
run: bun run build
- name: Typecheck
run: bun run typecheck
- name: Lint
run: bun run lint
- name: Core contract tests
run: bun run test -- packages/core/src/workflow-generator.test.ts packages/core/src/context.test.ts packages/core/src/config.test.ts packages/core/src/plugins/shared-workflow-helper.test.ts
snapshot-publish:
name: Snapshot publish (PR marker)
if: github.event_name == 'pull_request_target' && contains(github.event.pull_request.body || '', '#snapshot') && github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout PR head
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.22
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build
run: bun run build
- name: Detect pending changesets
id: changesets
run: |
COUNT=$(find .changeset -maxdepth 1 -name '*.md' ! -name 'README.md' | wc -l | tr -d ' ')
echo "count=$COUNT" >> "$GITHUB_OUTPUT"
if [ "$COUNT" -eq 0 ]; then
echo "No pending changesets found. Skipping snapshot publish."
fi
- name: Version snapshot from changesets
if: steps.changesets.outputs.count != '0'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: bunx changeset version --snapshot pr-${{ github.event.pull_request.number }}
- name: Configure npm auth for npmjs
if: steps.changesets.outputs.count != '0'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: |
echo "registry=https://registry.npmjs.org" >> ~/.npmrc
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" >> ~/.npmrc
- name: Publish snapshot tag
if: steps.changesets.outputs.count != '0'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: bunx changeset publish --tag pr-${{ github.event.pull_request.number }} --registry https://registry.npmjs.org