-
Notifications
You must be signed in to change notification settings - Fork 9
63 lines (63 loc) · 1.61 KB
/
build-and-check.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
name: Build & check
on:
pull_request:
types:
- opened
- synchronize
- reopened
- assigned
- closed
- edited
- labeled
- locked
- ready_for_review
- review_request_removed
- review_requested
- unassigned
- unlabeled
- unlocked
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
outputs:
changes: ${{ steps.check-for-changes.outputs.diff }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
- name: Get Yarn cache folder path
id: yarn-cache-folder
run: echo "path=$( yarn cache dir )" >> $GITHUB_OUTPUT
- name: Set up Yarn cache
id: yarn-cache
uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache-folder.outputs.path }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Node packages via Yarn
run: yarn install --frozen-lockfile --cache-folder ${{ steps.yarn-cache-folder.outputs.path }}
- name: Build
run: yarn build
- name: Check for changes
id: check-for-changes
run: |
{
echo "diff<<EOF"
git diff
echo "EOF"
} >> "$GITHUB_OUTPUT"
check:
name: Check distribution file
runs-on: ubuntu-latest
needs: build
steps:
- if: ${{ needs.build.outputs.changes != '' }}
name: Fail
run: exit 1