This repository has been archived by the owner on Dec 5, 2023. It is now read-only.
Get latest release versions #1440
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: Get latest release versions | |
on: | |
push: | |
paths: | |
- ".github/workflows/schedule.yml" | |
branches: | |
- main | |
schedule: | |
- cron: "0 10 * * *" | |
jobs: | |
get-version: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
token: ${{ secrets.PAT }} | |
fetch-depth: 1 | |
- name: Fetch new app versions | |
run: | | |
find ./build -maxdepth 1 -mindepth 1 -type d -exec basename {} \; | while read app; do | |
if test -f "./build/${app}/latest-version.sh"; then | |
version=$(bash "./build/${app}/latest-version.sh") | |
if [[ ! -z "${version}" || "${version}" != "null" ]]; then | |
echo "${version}" | tee "./build/${app}/.version" > /dev/null | |
echo "${app} ${version}" | |
fi | |
fi | |
done | |
- name: Check for modified files | |
id: git-check | |
run: echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi) | |
- name: Commit latest release version | |
if: steps.git-check.outputs.modified == 'true' | |
run: | | |
git config --global user.name 'Github Bot' | |
git config --global user.email 'bot@users.noreply.github.com' | |
git add -A | |
git commit -sam "[Auto Generation] Adding new release version" || exit 0 | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.PAT }} |