-
Notifications
You must be signed in to change notification settings - Fork 34
51 lines (44 loc) · 1.32 KB
/
preview.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
name: Build Preview
on:
push:
branches: ["master"]
paths-ignore:
- ".github/**"
workflow_dispatch:
concurrency: ci-prev
jobs:
build:
runs-on: ubuntu-latest
name: Automatically update submodule
steps:
- uses: actions/checkout@v3
with:
ref: "preview"
- name: Init git info
run: |
git status
git config user.name github-actions
git config user.email [email protected]
- name: Git reset to master branch
run: |
git fetch
git reset --hard origin/master
- name: Update submodule
id: submodule
run: |
git submodule init
echo "submodule_sha_origin=$(git submodule status | awk '{print $1}' | sed -r 's/[+-]+//g')" >> $GITHUB_OUTPUT
git submodule update --remote
echo "submodule_sha=$(git submodule status | awk '{print $1}' | sed -r 's/[+-]+//g')" >> $GITHUB_OUTPUT
echo "git_sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "build_date=$(date)" >> $GITHUB_OUTPUT
- name: Git commit and push submodules update
run: |
git add .
if [[ -z $(git status -s) ]]
then
git status
else
git commit -m "update submodules"
fi
git push -f