-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (64 loc) · 2.18 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
64
65
66
67
name: pages-update
run-name: pages update from main repository
on:
push:
repository_dispatch:
types: [update]
env:
REPO_OWNER: ""
REPO_NAME: ""
jobs:
update_dist:
name: update-push
runs-on: ubuntu-latest
steps:
- name: env setup
run: |
echo "REPO_OWNER=${GITHUB_REPOSITORY%/*}" >> $GITHUB_ENV
echo "REPO_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
- name: Repository checkout
uses: actions/checkout@v3
- name: Release download
uses: robinraju/release-downloader@v1.5
with:
repository: "${{ env.REPO_OWNER }}/mark-my-search"
latest: true
fileName: "mark_my_search-firefox.zip"
out-file-path: releases
- name: Release extract
run: unzip releases/mark_my_search-firefox.zip -d releases/mark_my_search-firefox
- name: Release archive
uses: actions/upload-artifact@v3
with:
name: dist
path: "releases/mark_my_search-firefox"
- name: Changes commit and push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git clone https://user:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY
rm -r ${{ env.REPO_NAME }}/dist/
ls -R releases/mark_my_search-firefox/dist/
cp -r releases/mark_my_search-firefox/dist/ ${{ env.REPO_NAME }}/
FILES="releases/mark_my_search-firefox/pages/*"
for file_path in $FILES; do
file_fullname="${file_path##*/}"
file_name="${file_fullname%.*}"
mkdir --parents ${{ env.REPO_NAME }}/pages/$file_name/
mv $file_path ${{ env.REPO_NAME }}/pages/$file_name/index.html
done
cd ${{ env.REPO_NAME }}
ls -R
cat polyfill.js dist/include/storage.js > temp
cat temp > dist/include/storage.js
rm temp
git config user.name "searchmarkers"
git config user.email "bot@searchmarkers.github.io"
if [ -z "$( git status --short )" ]
then
echo "nothing to commit"
else
git add .
git commit -m "Update from main repository"
git push
fi