update-repo #109
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: update-repo | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 6 * * 1' | |
jobs: | |
updateJellyfinRepo: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkingout | |
uses: actions/checkout@v3 | |
- name: Get Date | |
id: date | |
run: echo "::set-output name=date::$(date +'%Y%m%d')" | |
- name: Fetch Official Repo | |
run: | | |
cd /mnt/ | |
sudo wget -r -p -np -nc -k -e robots=off --reject=htm,html,js,css --user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.69" https://repo.jellyfin.org/releases/plugin/ | |
- name: Delete & Upgrade Plugins | |
run: | | |
cd $GITHUB_WORKSPACE | |
sudo rm -rf $GITHUB_WORKSPACE/plugin | |
sudo rm $GITHUB_WORKSPACE/manifest-stable-jsd.json | |
sudo mv /mnt/repo.jellyfin.org/releases/plugin $GITHUB_WORKSPACE/plugin | |
- name: Update Manifest list | |
env: | |
NDATE: ${{ steps.date.outputs.date }} | |
run: | | |
# NDATE=$(date +%Y%m%d) | |
sudo sed -i "s_repo.jellyfin.org/releases_cdn.jsdelivr.net/gh/LxnChan/jellyfin-plugin-mirror@${NDATE}_" "$GITHUB_WORKSPACE/plugin/manifest-stable.json" | |
sudo sed -i "s_https://github.com_https://gh-proxy.arlxn.top/https://github.com_" "$GITHUB_WORKSPACE/plugin/manifest-stable.json" | |
sudo sed -i "s_https://raw.githubusercontent.com_https://gh-proxy.arlxn.top/https://raw.githubusercontent.com_" "$GITHUB_WORKSPACE/plugin/manifest-stable.json" | |
sudo cp "$GITHUB_WORKSPACE/plugin/manifest-stable.json" "$GITHUB_WORKSPACE/manifest-stable-jsd.json" | |
- name: Commit & Push changes | |
uses: actions-js/push@master | |
with: | |
github_token: ${{ secrets.GITHUBTOKEN }} | |
message: "autopush from bot" | |
- name: Publish Release | |
env: | |
GTOKEN: ${{ secrets.GITHUBTOKEN }} | |
NDATE: ${{ steps.date.outputs.date }} | |
run: | | |
curl -X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${GTOKEN}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/LxnChan/jellyfin-plugin-mirror/releases \ | |
-d "{\"tag_name\": \"${NDATE}\",\"target_commitish\": \"main\",\"name\": \"${NDATE} update.\",\"body\": \"Update Automatically\",\"draft\": false,\"prerelease\": false,\"generate_release_notes\": false}" | |