From 508b7dc7a170e94cac4e70e915e3c0f2f28d2e25 Mon Sep 17 00:00:00 2001 From: dijunkun Date: Fri, 15 Aug 2025 19:41:04 +0800 Subject: [PATCH] [feat] add script to update the version number in github pages --- .github/workflows/update-pages.yaml | 47 +++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/update-pages.yaml diff --git a/.github/workflows/update-pages.yaml b/.github/workflows/update-pages.yaml new file mode 100644 index 0000000..30699b5 --- /dev/null +++ b/.github/workflows/update-pages.yaml @@ -0,0 +1,47 @@ +name: Update GitHub Pages Downloads + +on: + push: + tags: + - "v*" + +jobs: + update-pages: + runs-on: ubuntu-latest + steps: + - name: Checkout CrossDesk repo + uses: actions/checkout@v4 + + - name: Set version number + id: version + run: | + VERSION_NUM="${GITHUB_REF##*/}" + VERSION_NUM="${VERSION_NUM#v}" + echo "VERSION_NUM=${VERSION_NUM}" >> $GITHUB_ENV + echo "VERSION_NUM=${VERSION_NUM}" >> $GITHUB_OUTPUT + + - name: Checkout Pages repo + uses: actions/checkout@v4 + with: + repository: kunkundi/kunkundi.github.io + token: ${{ secrets.GH_PAGES_PAT }} + path: pages + + - name: Update download links + run: | + cd pages + sed -i "s/crossdesk-win-x86_64-latest.exe/crossdesk-win-x86_64-${VERSION_NUM}.exe/g" index.html + sed -i "s/crossdesk-macos-x86_64-latest.pkg/crossdesk-macos-x86_64-${VERSION_NUM}.pkg/g" index.html + sed -i "s/crossdesk-macos-arm64-latest.pkg/crossdesk-macos-arm64-${VERSION_NUM}.pkg/g" index.html + sed -i "s/crossdesk-linux-x86_64-latest.deb/crossdesk-linux-x86_64-${VERSION_NUM}.deb/g" index.html + + - name: Commit & Push changes + run: | + cd pages + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add index.html + git commit -m "Update download links to v${VERSION_NUM}" || echo "No changes to commit" + git push origin main + env: + VERSION_NUM: ${{ env.VERSION_NUM }}