mirror of
https://github.com/shenxn/protonmail-bridge-docker.git
synced 2026-01-18 06:34:41 +01:00
Add update checker
This commit is contained in:
35
check-update.sh
Normal file
35
check-update.sh
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
source ./releaserc
|
||||
|
||||
JSON_CONTENT=$(curl -q https://protonmail.com/download/current_version_linux.json)
|
||||
URL=$(echo ${JSON_CONTENT} | sed -n "s/^.*\"DebFile\":\"\([a-z0-9:/._-]*\)\".*$/\1/p")
|
||||
CURR_RELEASE=$(echo $URL | sed -n "s/https:\/\/protonmail.com\/download\/protonmail-bridge_\([0-9.-]*\)_amd64.deb/\1/p")
|
||||
|
||||
if [[ RELEASE != CURR_RELEASE ]]; then
|
||||
echo "New release found: ${CURR_RELEASE}"
|
||||
|
||||
# bump up to new release
|
||||
sed -i "s/^RELEASE=.*$/RELEASE=${CURR_RELEASE}/" releaserc
|
||||
|
||||
# commit
|
||||
git config --local user.email "actions@github.com"
|
||||
git config --local user.name "Github Action"
|
||||
git add releaserc
|
||||
git commit -m "Release ${CURR_RELEASE}" --author="Xiaonan Shen <s@sxn.dev>"
|
||||
git tag -a ${CURR_RELEASE} -m "Release ${CURR_RELEASE}"
|
||||
|
||||
# push
|
||||
REMOTE_REPO="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
|
||||
git push "${REMOTE_REPO}" master
|
||||
git push "${REMOTE_REPO}" master --tags
|
||||
|
||||
# trigger actions
|
||||
curl -H "Accept: application/vnd.github.everest-preview+json" \
|
||||
-H "Authorization: token ${PERSONAL_TOKEN}" \
|
||||
--request POST \
|
||||
--data '{"event_type": "update"}' \
|
||||
https://api.github.com/repos/${GITHUB_REPOSITORY}/dispatches
|
||||
fi
|
||||
Reference in New Issue
Block a user