-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (71 loc) · 1.86 KB
/
validate.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
86
# ========
# VALIDATE
# ========
name: Validate
# Activation Events
# =================
on: # rebuild any PRs and main branch changes
pull_request:
push:
branches:
- main
- "releases/*"
workflow_dispatch:
# Jobs
# ====
jobs:
# Build
# -----
build: # make sure build/ci works properly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
npm install
npm run build
# Check Dist
# ----------
check-dist: # Check whether the checked-in dist actually matches what we expect it to be
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set Node.js 16.x
uses: actions/setup-node@v4.0.2
with:
node-version: 16.x
- name: Install dependencies
run: npm ci
- name: Rebuild the dist/ directory
run: npm run dev
# If dist/index.js was different than expected, push changes
- name: check for changes
id: git-diff
if: ${{ github.ref == 'main' }}
run: |
if git diff --exit-code; then
echo "::set-output name=changes_exist::false"
else
echo "::set-output name=changes_exist::true"
fi
- name: push
if: ${{ steps.git-diff.outputs.changes_exist == 'true' }}
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git commit -m 'Build 📦'
git push
# Test
# ----
test: # make sure the action works on a clean machine without building
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./
with:
dryrun: true
create: true
update: true
delete: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}