mirror of
https://github.com/shenxn/protonmail-bridge-docker.git
synced 2025-12-06 08:27:08 +00:00
Add update check to build (#19)
* Remove armv7 temporarily * Improve build script * Add update check for build * Update README * Fix build script * Change build version format * Improve update check * Bump build version to v1.5.4 * Fix build Dockerfile * Fix build action yaml Co-authored-by: GitHub Actions <actions@github.com>
This commit is contained in:
parent
bde4667ff4
commit
2647f8540e
7
.github/workflows/build.yaml
vendored
7
.github/workflows/build.yaml
vendored
@ -16,6 +16,7 @@ on:
|
|||||||
env:
|
env:
|
||||||
DOCKER_REPO: shenxn/protonmail-bridge
|
DOCKER_REPO: shenxn/protonmail-bridge
|
||||||
DOCKER_REPO_DEV: ghcr.io/shenxn/protonmail-bridge-dev
|
DOCKER_REPO_DEV: ghcr.io/shenxn/protonmail-bridge-dev
|
||||||
|
PLATFORMS: linux/amd64,linux/arm64/v8
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@ -45,12 +46,12 @@ jobs:
|
|||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v1
|
||||||
with:
|
with:
|
||||||
driver-opts: network=host
|
driver-opts: network=host
|
||||||
- name: Build image without push to DockerHub
|
- name: Build image without push to registry
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
with:
|
with:
|
||||||
context: ./build
|
context: ./build
|
||||||
file: ./build/Dockerfile
|
file: ./build/Dockerfile
|
||||||
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7
|
platforms: ${{ env.PLATFORMS }}
|
||||||
push: true
|
push: true
|
||||||
tags: localhost:5000/protonmail-bridge:latest
|
tags: localhost:5000/protonmail-bridge:latest
|
||||||
- name: Scan image
|
- name: Scan image
|
||||||
@ -83,7 +84,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
context: ./build
|
context: ./build
|
||||||
file: ./build/Dockerfile
|
file: ./build/Dockerfile
|
||||||
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7
|
platforms: ${{ env.PLATFORMS }}
|
||||||
tags: |
|
tags: |
|
||||||
${{ steps.repo.outputs.repo }}:build
|
${{ steps.repo.outputs.repo }}:build
|
||||||
${{ steps.repo.outputs.repo }}:${{ steps.version.outputs.version }}-build
|
${{ steps.repo.outputs.repo }}:${{ steps.version.outputs.version }}-build
|
||||||
|
|||||||
6
.github/workflows/update-check.yaml
vendored
6
.github/workflows/update-check.yaml
vendored
@ -7,11 +7,11 @@ on:
|
|||||||
- dev
|
- dev
|
||||||
paths:
|
paths:
|
||||||
- .github/workflows/update-check.yaml
|
- .github/workflows/update-check.yaml
|
||||||
- update-check.sh
|
- update-check.py
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- .github/workflows/update-check.yaml
|
- .github/workflows/update-check.yaml
|
||||||
- update-check.sh
|
- update-check.py
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 0 * * *' # runs everyday at midnight
|
- cron: '0 0 * * *' # runs everyday at midnight
|
||||||
|
|
||||||
@ -24,4 +24,4 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
token: ${{ secrets.PERSONAL_TOKEN }}
|
token: ${{ secrets.PERSONAL_TOKEN }}
|
||||||
- name: Check Update
|
- name: Check Update
|
||||||
run: bash update-check.sh ${{ github.event_name == 'pull_request' }}
|
run: python3 update-check.py ${{ github.event_name == 'pull_request' }}
|
||||||
|
|||||||
@ -12,6 +12,10 @@ Docker Hub: [https://hub.docker.com/r/shenxn/protonmail-bridge](https://hub.dock
|
|||||||
|
|
||||||
GitHub: [https://github.com/shenxn/protonmail-bridge-docker](https://github.com/shenxn/protonmail-bridge-docker)
|
GitHub: [https://github.com/shenxn/protonmail-bridge-docker](https://github.com/shenxn/protonmail-bridge-docker)
|
||||||
|
|
||||||
|
## ARMv7 Builds
|
||||||
|
|
||||||
|
Currently there is a problem building the new parser targeting 32-bit architectures (i.e. `arm/v7`). The latest working build is `1.4.5-build`. Therefore, if you are using an `arm/v7` device like Raspberry Pi, do not upgrade to newer version. More information about the problem can be found [here](https://www.reddit.com/r/ProtonMail/comments/jvzm12/issue_building_bridge_150/). If you have any idea on how to fix this, a PR is welcome.
|
||||||
|
|
||||||
## ARM Support
|
## ARM Support
|
||||||
|
|
||||||
We now support ARM devices (`arm64` and `arm/v7`)! Use the images tagged with `build`. See next section for details.
|
We now support ARM devices (`arm64` and `arm/v7`)! Use the images tagged with `build`. See next section for details.
|
||||||
|
|||||||
@ -23,6 +23,6 @@ RUN apt-get update \
|
|||||||
COPY gpgparams entrypoint.sh /protonmail/
|
COPY gpgparams entrypoint.sh /protonmail/
|
||||||
|
|
||||||
# Copy protonmail
|
# Copy protonmail
|
||||||
COPY --from=build /build/proton-bridge/Desktop-Bridge /protonmail/
|
COPY --from=build /build/proton-bridge/proton-bridge /protonmail/
|
||||||
|
|
||||||
ENTRYPOINT ["bash", "/protonmail/entrypoint.sh"]
|
ENTRYPOINT ["bash", "/protonmail/entrypoint.sh"]
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
1.4.5
|
v1.5.4
|
||||||
@ -7,10 +7,7 @@ VERSION=`cat VERSION`
|
|||||||
# Clone new code
|
# Clone new code
|
||||||
git clone https://github.com/ProtonMail/proton-bridge.git
|
git clone https://github.com/ProtonMail/proton-bridge.git
|
||||||
cd proton-bridge
|
cd proton-bridge
|
||||||
git checkout br-$VERSION
|
git checkout $VERSION
|
||||||
|
|
||||||
# Enable debug log
|
|
||||||
sed -i "s/build desktop/-debug build desktop/" Makefile
|
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
make build-nogui
|
make build-nogui
|
||||||
|
|||||||
64
update-check.py
Normal file
64
update-check.py
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import requests
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
|
||||||
|
is_pull_request = sys.argv[1] == "true"
|
||||||
|
print(f"is_pull_request={is_pull_request}")
|
||||||
|
|
||||||
|
|
||||||
|
def check_version(directory, new_version):
|
||||||
|
print(f"Checking version for {directory}")
|
||||||
|
|
||||||
|
if not new_version:
|
||||||
|
print("Failed to get new version. Exiting.")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
with open(f"{directory}/VERSION", "r") as f:
|
||||||
|
old_version = f.read().rstrip()
|
||||||
|
|
||||||
|
print(f"Up-to-date version {new_version}")
|
||||||
|
print(f"Current version: {old_version}")
|
||||||
|
|
||||||
|
if old_version != new_version:
|
||||||
|
print(f"New release found: {new_version}")
|
||||||
|
|
||||||
|
# bump up to new release
|
||||||
|
with open(f"{directory}/VERSION", "w") as f:
|
||||||
|
f.write(new_version)
|
||||||
|
# commit
|
||||||
|
result = os.system(f"git config --local user.email 'actions@github.com' \
|
||||||
|
&& git config --local user.name 'GitHub Actions' \
|
||||||
|
&& git add {directory}/VERSION \
|
||||||
|
&& git commit -m 'Bump {directory} version to {new_version}'")
|
||||||
|
if result != 0:
|
||||||
|
print("Failed to commit the bump. Exiting")
|
||||||
|
exit(1)
|
||||||
|
if is_pull_request:
|
||||||
|
print("Action triggered by pull request. Do not push.")
|
||||||
|
else:
|
||||||
|
result = os.system("git push")
|
||||||
|
if result != 0:
|
||||||
|
print("Failed to push. Exiting")
|
||||||
|
exit(1)
|
||||||
|
else:
|
||||||
|
print(f"Already newest version {old_version}")
|
||||||
|
|
||||||
|
|
||||||
|
# check deb version
|
||||||
|
response = requests.get("https://protonmail.com/download/current_version_linux.json")
|
||||||
|
content = json.loads(response.content)
|
||||||
|
version = re.match(".*_([0-9.-]+)_amd64\.deb", content["DebFile"]).group(1)
|
||||||
|
check_version("deb", version)
|
||||||
|
|
||||||
|
|
||||||
|
# check build version
|
||||||
|
response = requests.get(
|
||||||
|
"https://api.github.com/repos/ProtonMail/proton-bridge/tags",
|
||||||
|
headers={"Accept": "application/vnd.github.v3+json"},
|
||||||
|
)
|
||||||
|
tags = json.loads(response.content)
|
||||||
|
version_re = re.compile("v(\d+)\.(\d+)\.(\d+)")
|
||||||
|
releases = [tag["name"] for tag in tags if version_re.match(tag["name"])]
|
||||||
|
check_version("build", releases[0])
|
||||||
@ -1,47 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
IS_PULL_REQUEST=$1
|
|
||||||
|
|
||||||
|
|
||||||
check_version() {
|
|
||||||
DIR=$1
|
|
||||||
CURR_VERSION=$2
|
|
||||||
|
|
||||||
echo "Checking version for ${DIR}"
|
|
||||||
|
|
||||||
VERSION=`cat ${DIR}/VERSION`
|
|
||||||
|
|
||||||
if [[ -z $CURR_VERSION ]]; then
|
|
||||||
echo "Failed to get new version. Existing."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $VERSION != $CURR_VERSION ]]; then
|
|
||||||
echo "New release found: ${CURR_VERSION}"
|
|
||||||
|
|
||||||
if [[ $IS_PULL_REQUEST == "true" ]]; then
|
|
||||||
echo "Action triggered by pull request. Do not bump version."
|
|
||||||
else
|
|
||||||
# bump up to new release
|
|
||||||
echo ${CURR_VERSION} > ${DIR}/VERSION
|
|
||||||
|
|
||||||
# commit
|
|
||||||
git config --local user.email "actions@github.com"
|
|
||||||
git config --local user.name "Github Action"
|
|
||||||
git add ${DIR}/VERSION
|
|
||||||
git commit -m "Bump ${DIR} version to ${CURR_VERSION}" --author="Xiaonan Shen <s@sxn.dev>"
|
|
||||||
git push
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Already newest version ${VERSION}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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_VERSION=$(echo $URL | sed -n "s/https:\/\/protonmail.com\/.*_\([0-9.-]*\)_.*.deb/\1/p")
|
|
||||||
check_version deb $CURR_VERSION
|
|
||||||
Loading…
Reference in New Issue
Block a user