Skip to content

pages update from main repository #263

pages update from main repository

pages update from main repository #263

Workflow file for this run

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