From 0930a255527051150f7b58b7d7465386682fa59c Mon Sep 17 00:00:00 2001 From: Zain Nasir Date: Tue, 17 Dec 2024 12:31:42 -0500 Subject: [PATCH] automate jitpack build and frontend version update --- .github/workflows/jitpack-build.yml | 53 ++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/.github/workflows/jitpack-build.yml b/.github/workflows/jitpack-build.yml index d6c2b36b4df..fc53fcf7e13 100644 --- a/.github/workflows/jitpack-build.yml +++ b/.github/workflows/jitpack-build.yml @@ -42,4 +42,55 @@ jobs: done echo "Failed to trigger JitPack build after $MAX_RETRIES attempts." - exit 1 \ No newline at end of file + exit 1 + + - name: Get POM File + run: | + TAG=${{ steps.get_tag.outputs.tag }} + JITPACK_POM_URL="https://jitpack.io/com/github/cbioportal/cbioportal-frontend/$TAG/cbioportal-frontend-$TAG.pom" + + MAX_RETRIES=10 + RETRY_DELAY=30 + COUNTER=0 + + while [ $COUNTER -lt $MAX_RETRIES ]; do + HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X POST "$JITPACK_POM_URL") + + if [ "$HTTP_STATUS" -eq 200 ]; then + echo "POM file successfully found." + exit 0 + else + echo "Attempt $((COUNTER+1)) failed with status $HTTP_STATUS: POM file not found yet. Retrying in $RETRY_DELAY seconds..." + COUNTER=$((COUNTER+1)) + sleep $RETRY_DELAY + fi + done + + echo "Failed to find POM file after $MAX_RETRIES attempts." + exit 1 + + - name: Set up SSH + run: | + mkdir -p ~/.ssh + echo "${{ secrets.BACKEND_REPO_TOKEN }}" > ~/.ssh/id_ed25519 + chmod 600 ~/.ssh/id_ed25519 + ssh-keyscan github.com >> ~/.ssh/known_hosts + + - name: Set up git + run: | + git config --global user.name 'github-actions' + git config --global user.email 'github-actions@github.com' + + - name: Checkout cbioportal/cbioportal + run: | + git clone git@github.com:cBioPortal/cbioportal.git + + - name: Update backend to use latest frontend commit + run: | + TAG=${{ steps.get_tag.outputs.tag }} + cd cbioportal + sed -i "s|\(.*\)-SNAPSHOT|\1|" pom.xml + sed -i "s|.*|$TAG|" pom.xml + git add pom.xml + git commit -m "Frontend $TAG" + git push \ No newline at end of file