mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-26 12:15:34 +08:00
[feat] add script to update the version number in github pages
This commit is contained in:
47
.github/workflows/update-pages.yaml
vendored
Normal file
47
.github/workflows/update-pages.yaml
vendored
Normal file
@@ -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 }}
|
||||
Reference in New Issue
Block a user