From fa9ac0152ebce005c441264c90a13058fd56b7d9 Mon Sep 17 00:00:00 2001 From: Xiaonan Shen Date: Wed, 4 May 2022 21:57:08 +0800 Subject: [PATCH] Some improvements --- .github/workflows/build.yaml | 15 +++++++++------ BRIDGE_VERSION | 1 + Dockerfile | 4 +++- VERSION | 2 +- build.sh | 6 ++---- 5 files changed, 16 insertions(+), 12 deletions(-) create mode 100644 BRIDGE_VERSION diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index fb28658..3b1a7eb 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -24,9 +24,11 @@ jobs: steps: - name: Checkout uses: actions/checkout@master - - name: Set version + - name: Set bridge version id: version - run: echo "::set-output name=version::`cat VERSION`" + run: | + echo "::set-output name=bridge_version::$(cat BRIDGE_VERSION)" + echo "::set-output name=version::$(cat VERSION)" - name: Set repo id: repo run: if [[ $GITHUB_REF == "refs/heads/master" ]]; then echo "::set-output name=repo::${DOCKER_REPO}"; else echo "::set-output name=repo::${DOCKER_REPO_DEV}"; fi @@ -45,6 +47,7 @@ jobs: uses: docker/build-push-action@v2 with: platforms: ${{ env.PLATFORMS }} + build-args: BRIDGE_VERSION=${{ steps.version.outputs.bridge_version }} push: true tags: localhost:5000/protonmail-bridge:latest - name: Scan image @@ -75,11 +78,11 @@ jobs: - name: Push image uses: docker/build-push-action@v2 with: - context: ./build - file: ./build/Dockerfile platforms: ${{ env.PLATFORMS }} + build-args: BRIDGE_VERSION=${{ steps.version.outputs.bridge_version }} tags: | - ${{ steps.repo.outputs.repo }}:build - ${{ steps.repo.outputs.repo }}:${{ steps.version.outputs.version }}-build + ${{ steps.repo.outputs.repo }}:beta + ${{ steps.repo.outputs.repo }}:${{ steps.version.outputs.version }} + ${{ steps.repo.outputs.repo }}:${{ steps.version.outputs.bridge-version }}-${{ steps.version.outputs.version }} labels: ${{ steps.docker_meta.outputs.labels }} push: ${{ github.event_name != 'pull_request' }} diff --git a/BRIDGE_VERSION b/BRIDGE_VERSION new file mode 100644 index 0000000..557fefc --- /dev/null +++ b/BRIDGE_VERSION @@ -0,0 +1 @@ +v2.1.3 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 680c911..ad0f379 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,9 +3,11 @@ FROM golang:1.15 AS build # Install dependencies RUN apt-get update && apt-get install -y libsecret-1-dev +ARG BRIDGE_VERSION + # Build WORKDIR /build/ -COPY build.sh VERSION /build/ +COPY build.sh /build/ COPY http_rest_frontend /build/http_rest_frontend RUN bash build.sh diff --git a/VERSION b/VERSION index abae0d9..83a60b2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.1.3 \ No newline at end of file +2.0-beta diff --git a/build.sh b/build.sh index a291f88..e287953 100644 --- a/build.sh +++ b/build.sh @@ -7,13 +7,11 @@ VERSION=`cat VERSION` # Clone new code git clone https://github.com/ProtonMail/proton-bridge.git cd proton-bridge -git checkout v$VERSION - -ls /build +git checkout ${BRIDGE_VERSION} # Patch HTTP REST frontend rm -rf internal/frontend/cli -cp -r /build/http_rest_frontend/cli internal/frontend/cli +cp -r /build/http_rest_frontend/cli internal/frontend/ # Build if ! make build-nogui ; then