Skip to content

Update asdf versions #172

Update asdf versions

Update asdf versions #172

# Name: update-asdf-versions.yaml
# Author: Mathew Fleisch <[email protected]>
# Description: This action will iterate through the .tool-versions file
# and grab the latest version for each line, unless it is pinned
# in the pin file. If there are changes to the .tool-versions file
# the action will automatically tag a new version number.
name: Update asdf versions
on:
schedule: # trigger Sundays at 12:20am PT (19:20UTC)
- cron: '20 19 * * 0'
workflow_dispatch:
jobs:
build:
name: Update asdf versions
runs-on:
- self-hosted
- generic-runner
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GIT_TOKEN }}
fetch-depth: 0
- name: "Update asdf versions"
run: |
echo "Current .tool-versions:"
cat .tool-versions
touch new-tool-versions
for dep in $(cat .tool-versions | cut -d' ' -f1); do
echo "$dep $(asdf latest $dep)" >> new-tool-versions
done
echo "Latest .tool-versions:"
cat new-tool-versions
cat new-tool-versions > .tool-versions
git config user.name github-actions
git config user.email [email protected]
git pull origin main
if [ -n "$(git status -s)" ]; then
git add .tool-versions
git commit -m "New asdf dependencies updated"
git push origin main
else
echo "There were no new updates to asdf dependencies..."
fi