forked from cBioPortal/cbioportal-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (79 loc) · 3.34 KB
/
jitpack-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# This GitHub Actions workflow triggers a JitPack build for the cbioportal-frontend repository whenever a new release is created.
# It constructs the JitPack build URL using the release tag and sends a request to initiate the build process.
name: Trigger JitPack Build on New Release
on:
release:
types:
- created
- prereleased
jobs:
trigger_build:
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v2
- name: Get release tag
id: get_tag
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Trigger JitPack Build
run: |
TAG=${{ steps.get_tag.outputs.tag }}
JITPACK_BUILD_URL="https://jitpack.io/com/github/cbioportal/cbioportal-frontend/$TAG/build.log"
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_BUILD_URL")
if [ "$HTTP_STATUS" -eq 200 ]; then
echo "Build triggered successfully for version ${TAG}."
exit 0
else
echo "Attempt $((COUNTER+1)) failed with status $HTTP_STATUS: Tag not found yet. Retrying in $RETRY_DELAY seconds..."
COUNTER=$((COUNTER+1))
sleep $RETRY_DELAY
fi
done
echo "Failed to trigger JitPack build after $MAX_RETRIES attempts."
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=60
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 '[email protected]'
- name: Checkout cbioportal/cbioportal
run: |
git clone [email protected]:cBioPortal/cbioportal.git
- name: Update backend to use latest frontend commit
run: |
TAG=${{ steps.get_tag.outputs.tag }}
cd cbioportal
sed -i "s|<version>\(.*\)-SNAPSHOT</version>|<version>\1</version>|" pom.xml
sed -i "s|<frontend.version>.*</frontend.version>|<frontend.version>$TAG</frontend.version>|" pom.xml
git add pom.xml
git commit -m "Frontend $TAG"
git push