From c7fe92177663fefbe483fc22503ad8b466c94c3d Mon Sep 17 00:00:00 2001 From: Opeyemi Date: Wed, 29 Nov 2023 14:54:36 +0000 Subject: [PATCH] [DEVOPS-1648] - Update commands to grab the latest web tag (#183) * test new command to grab clients tag * check what's in tag file * Delete comments --- .github/workflows/build-unified.yml | 2 +- docker-unified/Dockerfile | 13 ++++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-unified.yml b/.github/workflows/build-unified.yml index 37905d3..6509390 100644 --- a/.github/workflows/build-unified.yml +++ b/.github/workflows/build-unified.yml @@ -5,7 +5,7 @@ on: push: paths: - "docker-unified/**" - - ".github/workflows/build-self-host.yml" + - ".github/workflows/build-unified.yml" workflow_call: inputs: server_branch: diff --git a/docker-unified/Dockerfile b/docker-unified/Dockerfile index 7ae228b..58615af 100644 --- a/docker-unified/Dockerfile +++ b/docker-unified/Dockerfile @@ -9,20 +9,15 @@ RUN apt-get update && apt-get install -y \ curl \ jq \ unzip \ + git \ && rm -rf /var/lib/apt/lists/* WORKDIR /tmp -# Download tags from 'clients' repository -RUN --mount=type=secret,id=GH_PAT,target=/etc/secrets/GH_PAT if [ -e "/etc/secrets/GH_PAT" ]; then \ -curl --header "Authorization: token $(cat /etc/secrets/GH_PAT)" \ - https://api.github.com/repos/bitwarden/clients/git/refs/tags --output tags.json ; else \ - curl https://api.github.com/repos/bitwarden/clients/git/refs/tags --output tags.json ; fi - -RUN cat tags.json - # Grab last tag/release of the 'web' client -RUN cat tags.json | jq -r 'last(.[] | select(.ref|test("refs/tags/web-v[0-9]{4}.[0-9]{1,2}.[0-9]+"))) | .ref | split("/")[2]' > tag.txt +RUN git ls-remote --tags https://github.com/bitwarden/clients.git | grep refs/tags/web | cut -d/ -f3 | sort -Vr | head -1 > tag.txt + +RUN cat tag.txt # Extract the version of the 'web' client RUN cat tag.txt | grep -o -E "[0-9]{4}\.[0-9]{1,2}\.[0-9]+" > version.txt