-
-
Notifications
You must be signed in to change notification settings - Fork 315
63 lines (61 loc) · 1.95 KB
/
build.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
name: JS Build
on:
pull_request:
types: [opened, synchronize]
push:
branches:
- main
jobs:
check_yarn_lock:
runs-on: ubuntu-latest
name: Check yarn.lock
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get all changed markdown files
id: changed-yarn-lock
uses: tj-actions/changed-files@v41
with:
files: yarn.lock
outputs:
yarn_lock_changed: ${{ steps.changed-yarn-lock.outputs.any_changed }}
build:
runs-on: ubuntu-latest
name: Build JS packages
needs: check_yarn_lock
if: ${{ needs.check_yarn_lock.outputs.yarn_lock_changed }}
permissions:
contents: write
pull-requests: read
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Node
uses: actions/setup-node@v3
with:
cache: "yarn"
- name: Restore node_modules cache
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-modules
- name: Install dependencies
run: yarn install
- name: YARN build
run: yarn build
- name: Check git status
id: git-status
run: git diff --quiet || echo "::set-output name=changed::true"
- name: git push
if: steps.git-status.outputs.changed == true
run: |
git config --local user.name 'AlchemyCMS - CI Bot'
git config --local user.email 'alchemy@blish.cloud'
git remote set-url origin https://x-access-token:${{ secrets.ALCHEMY_CI_BOT_ACCESS_TOKEN }}@github.com/$GITHUB_REPOSITORY
git add vendor/javascript
git commit -m "Update JS packages" -m "Rebuilt packages due to updated dependencies."
git push origin HEAD:${{ github.event.pull_request.head.ref }}