Check new package versions #186
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} | |