forked from duhow/xiaoai-patch
-
Notifications
You must be signed in to change notification settings - Fork 1
34 lines (30 loc) · 1.46 KB
/
check_version.yaml
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
name: Check new package versions
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 1'
jobs:
check:
name: Check
if: ${{ github.repository == 'duhow/xiaoai-patch' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check version
run: |
BLUE='\033[0;34m'
NC='\033[0m'
(echo "REPO CURRENT TAG RELEASE";
for PACKAGE in $(find packages -name package.mk -type f -maxdepth 2 -mindepth 2 | cut -d'/' -f2); do
REPO=$(head packages/${PACKAGE}/package.mk | grep -e ^PACKAGE_SRC | grep github.com | cut -d'=' -f2 | tr -d '"' | cut -d'/' -f 4,5)
[ "${REPO}" = "" ] && continue
VERSION=$(grep -e ^PACKAGE_VERSION= packages/${PACKAGE}/package.mk | cut -d'=' -f2 | tr -d '"')
TAG=$(curl -s H 'User-Agent: GithubWorkflow' -u ${GITHUB_USER}:${GITHUB_TOKEN} https://api.github.com/repos/${REPO}/tags | jq -r '.[0].name')
RELEASE=$(curl -s H 'User-Agent: GithubWorkflow' -u ${GITHUB_USER}:${GITHUB_TOKEN} https://api.github.com/repos/${REPO}/releases/latest | jq -r '.tag_name')
(echo "master main devel" | grep -q ${VERSION}) || (echo "${TAG} ${RELEASE}" | grep -q ${VERSION}) || echo -ne "${BLUE}"
echo "${REPO} ${VERSION} ${TAG} ${RELEASE}"
echo -ne "${NC}"
done) | column -t || true
env:
GITHUB_USER: ${{ github.repository_owner }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}