Check versions #98
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 versions | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '30 4 * * TUE' | |
jobs: | |
check: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: versions | |
run: | | |
issue_text="Needing updates: " | |
staphb_containers=($(grep -h container modules/local/* | grep staphb | grep -v "//" | sort | uniq | grep -v latest | awk '{print $2}' | sed 's/'\''//g')) | |
for container in ${staphb_containers[@]} | |
do | |
echo "Looking at $container" | |
base=$(echo $container | cut -f 1 -d ":") | |
repo_version=$(echo $container | cut -f 2 -d ":") | |
docker pull $base:latest | |
latest_version=$(docker inspect --format '{{ index .Config.Labels "software.version"}}' $base:latest) | |
if [[ "$latest_version" == "$repo_version" ]] | |
then | |
echo "No version change for $base:$repo_version" | tee -a versions.txt | |
else | |
echo "New version for $base! Upgrade to $latest_version from $repo_version." | tee -a versions.txt | |
issue_text="$issue_text<br>- $base from $repo_version to $latest_version " | |
fi | |
docker rmi $base:latest | |
done | |
echo $issue_text | |
cat versions.txt | |
echo 'ISSUE_TEXT='$issue_text >> $GITHUB_ENV | |
- name: Create Issue | |
run: | | |
gh issue create --title "Version check" --body "$ISSUE_TEXT" --repo $GITHUB_REPOSITORY | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |