add proton bridge version check and update
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
name: Check and Autoupdate for ProtonMail Bridge
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 3 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
check-update:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Get current version from file
|
||||
id: current
|
||||
run: |
|
||||
CURRENT_VERSION=$(cat VERSION)
|
||||
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Fetch latest ProtonMail Bridge release tag
|
||||
id: latest
|
||||
run: |
|
||||
LATEST_VERSION=$(curl -s https://api.github.com/repos/ProtonMail/proton-bridge/releases/latest | jq -r .tag_name)
|
||||
echo "latest_version=$LATEST_VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Compare versions
|
||||
id: compare
|
||||
run: |
|
||||
echo "Current: ${{ steps.current.outputs.current_version }}"
|
||||
echo "Latest: ${{ steps.latest.outputs.latest_version }}"
|
||||
if [ "${{ steps.current.outputs.current_version }}" != "${{ steps.latest.outputs.latest_version }}" ]; then
|
||||
echo "new_version=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "new_version=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Act on update
|
||||
if: steps.compare.outputs.new_version == 'true'
|
||||
run: |
|
||||
echo "🎉 New version available: ${{ steps.latest.outputs.latest_version }}"
|
||||
echo "${{ steps.latest.outputs.latest_version }}" > VERSION
|
||||
# Optional: Commit and push the new version file
|
||||
git config user.name "Gitea Bot"
|
||||
git config user.email "actions@gitea.local"
|
||||
git add VERSION
|
||||
git commit -m "Update ProtonMail Bridge to ${{ steps.latest.outputs.latest_version }}"
|
||||
git push
|
||||
Reference in New Issue
Block a user