-
Notifications
You must be signed in to change notification settings - Fork 1
63 lines (54 loc) · 1.9 KB
/
main.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: Update UI Files
env:
SOURCE_REPO: DesignPlain/PlainDashboard
USERNAME: ${{ github.actor }}
PATH_SOURCE_CHECKOUT: ui_code
PATH_TARGET_CHECKOUT: server_code
TARGET_FILE: "provider/cmd/pulumi-resource-aws/schema.json"
on:
workflow_dispatch:
repository_dispatch:
types: [Trigger-UI-File-Update]
permissions: write-all
jobs:
UpdateFiles:
runs-on: ubuntu-latest
steps:
- name: Checkout DesignPlain/PlainDashboard repo
uses: actions/checkout@v4
with:
repository: ${{ env.SOURCE_REPO }}
path: ${{ env.PATH_SOURCE_CHECKOUT }}
- name: Install node and build project
run: |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
. ~/.nvm/nvm.sh 2>&1
nvm install node
. ~/.nvm/nvm.sh 2>&1
cd $PATH_SOURCE_CHECKOUT
npm install
npm run build
cd ..
echo "MergeChanges=true" >> $GITHUB_ENV
- name: Checkout DesignPlain/PlainServer repo
uses: actions/checkout@v4
with:
path: ${{ env.PATH_TARGET_CHECKOUT }}
- name: Copy UI files and commit changes
if: env.MergeChanges == 'true'
run: |
cp -r $PATH_SOURCE_CHECKOUT/dist/design-sphere $PATH_TARGET_CHECKOUT
cd $PATH_TARGET_CHECKOUT
pwd;ls
rm -r ui 2>&1
mv design-sphere ui
if [[ $(git diff --name-only|wc -l) -gt 0 ]]; then
echo "We do have changes between the UI files, we are committing the changes."
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
git commit -am "Updated UI files"
git push -f origin main
else
echo "We have no changes between UI files, exiting."
fi
cd ..