forked from Mouws/protonmail-bridge-nextcoud-podman
Improve update check
This commit is contained in:
parent
961f9c70dd
commit
2c9ef4cd8d
7
.github/workflows/update-check.yaml
vendored
7
.github/workflows/update-check.yaml
vendored
@ -3,7 +3,11 @@ name: update check
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- update-check
|
- master
|
||||||
|
- dev
|
||||||
|
paths:
|
||||||
|
- .github/workflows/update-check.yaml
|
||||||
|
- update-check.sh
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 0 * * *' # runs everyday at midnight
|
- cron: '0 0 * * *' # runs everyday at midnight
|
||||||
|
|
||||||
@ -16,5 +20,4 @@ jobs:
|
|||||||
- name: Check Update
|
- name: Check Update
|
||||||
run: bash update-check.sh
|
run: bash update-check.sh
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
|
PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
|
||||||
|
|||||||
@ -2,39 +2,33 @@
|
|||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
REMOTE_REPO="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
|
REMOTE_REPO="https://${GITHUB_ACTOR}:${PERSONAL_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
|
||||||
|
|
||||||
# Switch to master branch
|
VERSION=`cat VERSION`
|
||||||
git clone "${REMOTE_REPO}" master
|
|
||||||
cd master
|
|
||||||
|
|
||||||
source ./releaserc
|
|
||||||
|
|
||||||
JSON_CONTENT=$(curl -q https://protonmail.com/download/current_version_linux.json)
|
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")
|
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")
|
CURR_VERSION=$(echo $URL | sed -n "s/https:\/\/protonmail.com\/download\/protonmail-bridge_\([0-9.-]*\)_amd64.deb/\1/p")
|
||||||
|
|
||||||
if [[ $RELEASE != $CURR_RELEASE ]]; then
|
if [[ $VERSION != $CURR_VERSION ]]; then
|
||||||
echo "New release found: ${CURR_RELEASE}"
|
echo "New release found: ${CURR_VERSION}"
|
||||||
|
|
||||||
# bump up to new release
|
# bump up to new release
|
||||||
sed -i "s/^RELEASE=.*$/RELEASE=${CURR_RELEASE}/" releaserc
|
cat ${CURR_VERSION} > VERSION
|
||||||
|
|
||||||
# commit
|
# commit
|
||||||
git config --local user.email "actions@github.com"
|
git config --local user.email "actions@github.com"
|
||||||
git config --local user.name "Github Action"
|
git config --local user.name "Github Action"
|
||||||
git add releaserc
|
git add VERSION
|
||||||
git commit -m "Release ${CURR_RELEASE}" --author="Xiaonan Shen <s@sxn.dev>"
|
git commit -m "Bump version to ${CURR_VERSION}" --author="Xiaonan Shen <s@sxn.dev>"
|
||||||
git tag -a "v${CURR_RELEASE}" -m "Release ${CURR_RELEASE}"
|
|
||||||
|
|
||||||
# push
|
# push
|
||||||
git push "${REMOTE_REPO}" master
|
git push "${REMOTE_REPO}" master
|
||||||
git push "${REMOTE_REPO}" master --tags
|
|
||||||
|
|
||||||
# trigger actions
|
# # trigger actions
|
||||||
curl -H "Accept: application/vnd.github.everest-preview+json" \
|
# curl -H "Accept: application/vnd.github.everest-preview+json" \
|
||||||
-H "Authorization: token ${PERSONAL_TOKEN}" \
|
# -H "Authorization: token ${PERSONAL_TOKEN}" \
|
||||||
--request POST \
|
# --request POST \
|
||||||
--data '{"event_type": "build"}' \
|
# --data '{"event_type": "build"}' \
|
||||||
https://api.github.com/repos/${GITHUB_REPOSITORY}/dispatches
|
# https://api.github.com/repos/${GITHUB_REPOSITORY}/dispatches
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user