Update Dashboard #162
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 Dashboard | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "30 17 * * *" | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "README.md" | |
- ".github/workflows/delete-old-workflows.yml" | |
- ".github/workflows/update-adguardhome.yml" | |
- ".github/workflows/update-mihomo.yml" | |
- ".github/workflows/update-singbox.yml" | |
jobs: | |
Update: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone Repository | |
uses: actions/checkout@main | |
- name: Checkout `yacd` | |
uses: actions/checkout@v4 | |
with: | |
repository: haishanh/yacd | |
fetch-depth: 0 | |
- name: Get `yacd` version and time | |
run: | | |
yacd_version=$(git describe --tags --abbrev=0 HEAD) | |
echo "yacd_version=$yacd_version" >> ${GITHUB_ENV} | |
yacd_time=$(git log -1 --format=%cd --date=format:'%Y-%m-%d' ${yacd_version}) | |
echo "yacd_time=$yacd_time" >> ${GITHUB_ENV} | |
- name: Checkout `Yacd-meta` | |
uses: actions/checkout@v4 | |
with: | |
repository: MetaCubeX/Yacd-meta | |
fetch-depth: 0 | |
- name: Get `Yacd-meta` version and time | |
run: | | |
yacd_meta_version=$(git describe --tags --abbrev=0 HEAD) | |
echo "yacd_meta_version=$yacd_meta_version" >> ${GITHUB_ENV} | |
yacd_meta_time=$(git log -1 --format=%cd --date=format:'%Y-%m-%d' ${yacd_meta_version}) | |
echo "yacd_meta_time=$yacd_meta_time" >> ${GITHUB_ENV} | |
- name: Checkout `metacubexd` | |
uses: actions/checkout@v4 | |
with: | |
repository: MetaCubeX/metacubexd | |
fetch-depth: 0 | |
- name: Get `metacubexd` version and time | |
run: | | |
metacubexd_version=$(git describe --tags --abbrev=0 HEAD) | |
echo "metacubexd_version=$metacubexd_version" >> ${GITHUB_ENV} | |
metacubexd_time=$(git log -1 --format=%cd --date=format:'%Y-%m-%d' ${metacubexd_version}) | |
echo "metacubexd_time=$metacubexd_time" >> ${GITHUB_ENV} | |
- name: Checkout `zashboard` | |
uses: actions/checkout@v4 | |
with: | |
repository: Zephyruso/zashboard | |
fetch-depth: 0 | |
- name: Get `zashboard` version and time | |
run: | | |
zashboard_version=$(git describe --tags --abbrev=0 HEAD) | |
echo "zashboard_version=$zashboard_version" >> ${GITHUB_ENV} | |
zashboard_time=$(git log -1 --format=%cd --date=format:'%Y-%m-%d' ${zashboard_version}) | |
echo "zashboard_time=$zashboard_time" >> ${GITHUB_ENV} | |
- name: Download and compress `yacd` dashboard | |
run: | | |
mkdir -p ./Dashboard/ ./tmp/yacd/ | |
curl -o ./tmp/yacd/gh-pages.zip -L https://github.com/haishanh/yacd/archive/refs/heads/gh-pages.zip | |
unzip -o ./tmp/yacd/gh-pages.zip -d ./tmp/yacd/ | |
tar -czf ./Dashboard/yacd.tar.gz -C ./tmp/yacd/yacd-gh-pages/ . | |
- name: Download and compress `Yacd-meta` dashboard | |
run: | | |
mkdir -p ./tmp/Yacd-meta/ | |
curl -o ./tmp/Yacd-meta/gh-pages.zip -L https://github.com/MetaCubeX/Yacd-meta/archive/refs/heads/gh-pages.zip | |
unzip -o ./tmp/Yacd-meta/gh-pages.zip -d ./tmp/Yacd-meta/ | |
tar -czf ./Dashboard/Yacd-meta.tar.gz -C ./tmp/Yacd-meta/Yacd-meta-gh-pages/ . | |
- name: Download and compress `metacubexd` dashboard | |
run: | | |
mkdir -p ./tmp/metacubexd/ | |
curl -o ./tmp/metacubexd/gh-pages.zip -L https://github.com/MetaCubeX/metacubexd/archive/refs/heads/gh-pages.zip | |
unzip -o ./tmp/metacubexd/gh-pages.zip -d ./tmp/metacubexd/ | |
tar -czf ./Dashboard/metacubexd.tar.gz -C ./tmp/metacubexd/metacubexd-gh-pages/ . | |
- name: Download and compress `zashboard` dashboard | |
run: | | |
mkdir -p ./tmp/zashboard/ | |
curl -o ./tmp/zashboard/gh-pages.zip -L https://github.com/Zephyruso/zashboard/releases/latest/download/dist-cdn-fonts.zip | |
unzip -o ./tmp/zashboard/gh-pages.zip -d ./tmp/zashboard/ | |
tar -czf ./Dashboard/zashboard.tar.gz -C ./tmp/zashboard/dist/ . | |
rm -rf ./tmp* | |
- name: Release and upload `Dashboard` assets | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
release_name: Dashboard | |
tag: Dashboard | |
overwrite: true | |
body: | | |
更新 [yacd 面板](https://github.com/haishanh/yacd)至 ${{ env.yacd_version }},发布于 ${{ env.yacd_time }} | |
更新 [Yacd-meta 面板](https://github.com/MetaCubeX/Yacd-meta)至 ${{ env.yacd_meta_version }},发布于 ${{ env.yacd_meta_time }} | |
更新 [metacubexd 面板](https://github.com/MetaCubeX/metacubexd)至 ${{ env.metacubexd_version }},发布于 ${{ env.metacubexd_time }} | |
更新 [zashboard 面板](https://github.com/Zephyruso/zashboard)至 ${{ env.zashboard_version }},发布于 ${{ env.zashboard_time }} | |
file_glob: true | |
file: ./Dashboard/* | |
- name: Purge jsDelivr CDN | |
run: | | |
cd ./Dashboard/ || exit 1 | |
for file in $(ls); do | |
curl -i "https://purge.jsdelivr.net/gh/${{ github.repository }}@Dashboard/${file}" | |
done |