forked from jakoch/install-vulkan-sdk-action
-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (51 loc) · 2.02 KB
/
check-dist.yml
File metadata and controls
65 lines (51 loc) · 2.02 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
#
# SPDX-FileCopyrightText: 2021-2026 Jens A. Koch.
# SPDX-License-Identifier: MIT
#
# This file is part of https://github.com/jakoch/install-vulkan-sdk-action
# This workflow checks the `dist/` directory for uncommitted changes by comparing it with a fresh build from `src/`.
# `dist/index.js` is a crucial file in GitHub Actions.
# When an action is referenced using `uses:` in a workflow, `dist/index.js` serves as the entry point.
# In our project, this file is generated through a build process from `src/*.ts` source files.
# To maintain consistency, we must ensure that the checked-in `dist/index.js` is always up to date with the source files.
# This workflow prevents cases where source files are modified but `dist/index.js` is not regenerated.
name: "❔️ Check Dist Folder"
on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
workflow_dispatch:
jobs:
# ---------------------------------------------------------------------------------------
check-dist:
# ---------------------------------------------------------------------------------------
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup Node.js v20
uses: actions/setup-node@v6
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Rebuild the dist/ directory
run: npm run build
- name: Compare the expected and actual dist/ directories
id: diff
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v6 # https://github.com/actions/upload-artifact
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/