Skip to content

dfx Update

dfx Update #105

Workflow file for this run

# A GitHub Actions workflow that regularly checks for new dfx releases
# and creates a PR on new versions.
name: dfx Update
on:
schedule:
# check for new dfx releases daily at 7:30
- cron: '30 7 * * *'
workflow_dispatch:
jobs:
dfx-update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# First, check dfx releases (on the SDK repo) for a new version.
- name: Check new dfx version
id: update
run: |
current_dfx_release=$(jq -r .dfx < dfx.json)
echo "current dfx release '$current_dfx_release'"
latest_dfx_release=$(curl -sSL https://api.github.com/repos/dfinity/sdk/releases/latest | jq .tag_name -r)
echo "latest dfx release '$latest_dfx_release'"
if [ "$current_dfx_release" != "$latest_dfx_release" ]
then
echo dfx needs an update
sed -i -e \
"s/$current_dfx_release/$latest_dfx_release/g" \
"dfx.json"
echo "updated=1" >> "$GITHUB_OUTPUT"
else
echo "updated=0" >> "$GITHUB_OUTPUT"
fi
cat ./dfx.json
# If the dfx.json was updated, create a PR.
- name: Create Pull Request
if: ${{ steps.update.outputs.updated == '1' }}
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GIX_BOT_PAT }}
base: main
add-paths: ./dfx.json
commit-message: Update didc release
committer: GitHub <[email protected]>
author: gix-bot <[email protected]>
branch: bot-dfx-update
delete-branch: true
title: 'Update dfx'
# Since this is a scheduled job, a failure won't be shown on any
# PR status. To notify the team, we send a message to our Slack channel on failure.
- name: Notify Slack on failure
uses: ./.github/actions/slack
if: ${{ failure() }}
with:
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MESSAGE: "dfx update failed"