-
Notifications
You must be signed in to change notification settings - Fork 59
50 lines (43 loc) · 1.48 KB
/
check-lib.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
# This workflow verifies lib/main.js has latest changes from src/*.ts
on: pull_request
jobs:
check-lib:
name: Build main.js and diff on
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
steps:
- name: Check out
uses: actions/checkout@v4
- name: Validate build
run: |
npm install
npm run build
- name: Check if main.js has differences
if: matrix.os != 'windows-latest'
run: echo "diff=$(git diff --ignore-space-at-eol --text lib/main.js | wc -l)" >> $GITHUB_ENV
- name: Check if main.js has differences
if: matrix.os == 'windows-latest'
run: echo "diff=$(git diff --ignore-space-at-eol --text lib/main.js | wc -l)" >> $env:GITHUB_ENV
# If main.js was different than expected, upload the actual version
- name: Upload actual main.js
if: ${{ env.diff > 0}}
uses: actions/upload-artifact@v4
with:
name: main.js-${{ matrix.os }}
path: lib/main.js
final-check:
name: Check if main.js has differences on both Ubuntu and Windows
runs-on: ubuntu-latest
needs: check-lib
steps:
- name: Download artifact
uses: actions/download-artifact@v4
- name: Check if both artifacts exist
run: |
ls -R
if [ -d "main.js-windows-latest" ] && [ -d "main.js-ubuntu-latest" ]; then
echo "main.js difference detected. Please check the artifacts for more details."
exit 1
fi