-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (39 loc) · 1.41 KB
/
update.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
name: main
on:
push:
schedule:
- cron: '0 0 * * *'
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Check out the main branch
uses: actions/checkout@v3
with:
ref: main
- name: Run the workflow
run: |
set -e
set -x
# Configure Git for the push from the workflow to the repository
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
# Run the script
git submodule init
git submodule update
cp UZIP.js/UZIP.js index.js
echo "export default UZIP;" >> index.js
# Stage the Git index changes (index.js and the submodule) resulting from the CI script
git add *
# Reset unstaged changes so that Git commit won't fail (e.g.: package-lock.json, temporary files, …)
git checkout -- .
# Bail if there are no changes to commit and hence no GitHub Pages to build
if git diff-index --quiet HEAD --; then
exit
fi
# Commit the staged changes to the workflow repository
git commit -m "Update submodule and UZIP.js ESM"
# Rebase if the branch has changed meanwhile or fail on automatically irresolvable conflicts
git pull --rebase
# Push the commit to the workflow repository
git push