Add .gitea/workflows/update.yaml

This commit is contained in:
2025-07-23 17:44:19 +00:00
parent c0a0826118
commit 7333ccf63c

View File

@@ -0,0 +1,66 @@
name: Auto Update Vesktop Template
on:
schedule:
- cron: '0 12 * * *'
workflow_dispatch:
jobs:
update-template:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Dependencies
run: sudo apt-get update && sudo apt-get install -y curl jq
- name: Fetch Latest Stable Release
id: get_release
run: |
RELEASES=$(curl -s -H "User-Agent: gitea-actions" https://api.github.com/repos/Vencord/Vesktop/releases?per_page=50)
LATEST=$(echo "$RELEASES" | jq '[.[] | select(.tag_name | test("^v\\\\d+\\\\.\\\\d+\\\\.\\\\d+$"))] | sort_by(.published_at) | reverse | .[0]')
if [[ -z "$LATEST" ]]; then
echo "No stable release found"
exit 0
fi
TAG=$(echo "$LATEST" | jq -r '.tag_name')
VERSION=${TAG#v}
DEB_URL=$(echo "$LATEST" | jq -r ".assets[] | select(.name == \"vesktop_${VERSION}_amd64.deb\") | .browser_download_url")
if [[ -z "$DEB_URL" ]]; then
echo "No .deb found"
exit 0
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "deb_url=$DEB_URL" >> $GITHUB_OUTPUT
- name: Read Current Version
if: steps.get_release.outputs.version
id: check_version
run: |
CURRENT_VERSION=$(grep '^version=' template | cut -d= -f2)
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
- name: Download and Checksum
if: steps.get_release.outputs.version && steps.get_release.outputs.version != steps.check_version.outputs.current_version
id: download
run: |
curl -Lo vesktop.deb "${{ steps.get_release.outputs.deb_url }}"
SHA256=$(sha256sum vesktop.deb | awk '{print $1}')
echo "sha256=$SHA256" >> $GITHUB_OUTPUT
- name: Update Template
if: steps.get_release.outputs.version && steps.get_release.outputs.version != steps.check_version.outputs.current_version
run: |
sed -i "s/^version=.*/version=${{ steps.get_release.outputs.version }}/" template
sed -i "s/^checksum=.*/checksum=${{ steps.download.outputs.sha256 }}/" template
- name: Commit and Push
if: steps.get_release.outputs.version && steps.get_release.outputs.version != steps.check_version.outputs.current_version
run: |
git config user.name "Wizzard"
git config user.email "rich@bandaholics.cash"
git add template
git commit -m "Update to v${{ steps.get_release.outputs.version }} [auto]"
git push