-
Notifications
You must be signed in to change notification settings - Fork 8
81 lines (70 loc) · 2.57 KB
/
check-deps-versions.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
on:
schedule:
- cron: '0 1 * * *'
push:
branches:
- dev
name: Check Dependencies Versions
jobs:
build:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.PRIVATE_TOKEN }}
strategy:
matrix:
branch: [dev]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ matrix.branch }}
- name: Set up Git
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Fetch all branches
run: git fetch --all
- name: Check if branch exists
id: check_branch
run: |
BRANCH_EXISTS=$(git ls-remote --heads origin pr@${{ matrix.branch }}@upgrade_client)
if [ -n "$BRANCH_EXISTS" ]; then
echo "Branch exists, checking it out."
echo "branch_exists=true" >> $GITHUB_ENV
else
echo "Branch does not exist, will create new one."
echo "branch_exists=false" >> $GITHUB_ENV
fi
- name: Checkout existing branch or create new one
run: |
if [ "$branch_exists" == "true" ]; then
git checkout pr@${{ matrix.branch }}@upgrade_client
else
git checkout -b pr@${{ matrix.branch }}@upgrade_client
fi
- name: Check client version
run: |
version=$(curl -s https://api.github.com/repos/jumpserver/clients/releases/latest | jq -r .tag_name)
sed -i "s/Client_VERSION=.*/Client_VERSION=${version}/g" versions.txt
- name: Check player version
run: |
version=$(curl -s https://api.github.com/repos/jumpserver/VideoPlayer/releases/latest | jq -r .tag_name | sed 's/v//')
echo "version=${version}" >> $GITHUB_ENV
sed -i "s/VIDEO_PLAYER_VERSION=.*/VIDEO_PLAYER_VERSION=${version}/g" versions.txt
- name: Check tinker version
run: |
version=$(curl -s -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/repos/jumpserver/tinker/releases/latest | jq -r .tag_name)
sed -i "s/TINKER_VERSION=.*/TINKER_VERSION=${version}/g" versions.txt
- name: Need update
run: |
need_update=0
if [ -n "$(git status --porcelain)" ]; then
need_update=1
fi
echo "need_update=${need_update}" >> $GITHUB_ENV
- name: Update Client Version
if: env.need_update == '1'
run: |
git add .
git commit -m "Update pkg versions"
git push origin